#!/usr/bin/env python3
import sys
import random

n = int(sys.argv[1])
max_x = int(sys.argv[2])
random.seed(int(sys.argv[3]))

initial = random.randint(max_x // 3,(2*max_x) // 3)
direction = 2*random.randint(0,1) - 1

if max_x < 2*n:
    times = random.sample(list(range(max_x // 3)), k=n)
else:
    times = set()
    while len(times) < n:
        t = random.randint(0,max_x//3)
        if t not in times:
            times.add(t)
    times = list(times)
random.shuffle(times)

print(n)
for t in times:
    print(t,initial + direction*t)
