<s> class ListNode : <EOL> def __init__ ( self , x ) : <EOL> self . val = x <EOL> self . next = None <EOL> def __repr__ ( self ) : <EOL> if self : <EOL> return "<STR_LIT>" . format ( self . val , self . next ) <EOL> class Solution : <EOL> def swapPairs ( self , head ) : <EOL> dummy = ListNode ( <NUM_LIT:0> ) <EOL> dummy . next = head <EOL> current = dummy <EOL> while current . next and current . next . next : <EOL> next_one , next_two , next_three = current . next , current . next . next , current . next . next . next <EOL> current . next = next_two <EOL> next_two . next = next_one <EOL> next_one . next = next_three <EOL> current = next_one <EOL> return dummy . next <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> head = ListNode ( <NUM_LIT:1> ) <EOL> head . next , head . next . next , head . next . next . next = ListNode ( <NUM_LIT:2> ) , ListNode ( <NUM_LIT:3> ) , ListNode ( <NUM_LIT:4> ) <EOL> print Solution ( ) . swapPairs ( head ) </s>
