public static ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }
        
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        
        ListNode start = dummy;
        ListNode p, q;
        while (start.next != null && start.next.next != null) {
            p = start.next;
            q = start.next.next;
            p.next = q.next;
            q.next = p;
            start.next = q;
            start = p;
        }
        return dummy.next;
    }