Cant understand the print function here

please guide me what this for(auto i:adjlist) does

It iterates over the adjlist. Auto automatically gives the data-type to the i. The data-type will be of that of the adjlist.

vectorvec;
vec.push_back(1)
vec.push_back(2)

for(auto it:vec)
cout << it << " ";

It means it will iterate in the vector, first being 1 and then 2.