Doubt related to set of pairs

In the below pic, sir has used 2 ways to refer to the first element of the pairs.
it->first and p.first
are these both correct?? and is there any situation where we have to use the one and the other??

hello @sahilkhan2312000131
you forgot to attach the pic.

@sahilkhan2312000131

in case of iterators we use ->(arrow) operator.

in case of object we use . (dot) operator

in line 18 we have itertor thats why we are using -> (arrow)
in line 21 we have object that why we are using dot operator

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.