#!/usr/bin/env python3

for t in range(46, 61):
    newt = t + 15   # 46 -> 61, ..., 60 -> 75

    in_file = f"task{t}.in"
    out_file = f"task{t}.out"
    new_file = f"task{newt}.in"

    with open(out_file) as f:
        ans = [int(line.strip()) for line in f if line.strip()]

    with open(in_file) as f:
        lines = f.read().strip().splitlines()

    n, m, c = map(int, lines[0].split())

    new_lines = []
    new_lines.append(f"{n} {m} 1")
    new_lines.append(lines[1])

    for i in range(m):
        l, r = map(int, lines[2 + i].split())

        prev = 0 if i == 0 else ans[i - 1]

        l ^= prev
        r ^= prev

        new_lines.append(f"{l} {r}")

    with open(new_file, "w") as f:
        f.write("\n".join(new_lines) + "\n")

    print(f"Created {new_file}")
