educative.io

While loop in merging linked list

in the while loop, I am confused by this portion:
s.next = p
s = p
p = s.next

If p is 1, then s.next = p means that s.next becomes 1
then, s = p, means that s is equal to p, so s becomes 1. now, both s and s.next are equal to 1
then, p = s.next. but s.next is 1, so p =1?! so s.next, s and p, are all equal to 1 at the end of these 3 lines?