#!/usr/bin/python
# -*- coding: cp1251 -*-
"""
Author: Vladimir Ulyantsev, ulyantsev@rain.ifmo.ru
"""
import random
from random import randint

test_number = 1
hand_tests = []

def init_test_number():
    global test_number, hand_tests
    import glob
    hand_tests = [int(s) for s in glob.glob("[0-9][0-9].t")]
    while test_number in hand_tests:
        test_number += 1

def open_output():
    global test_number
    s = "%d%d" % divmod(test_number, 10)
    print "Generating test #" + s
    test_number += 1
    while test_number in hand_tests:
        test_number += 1
    return open(s, "w")

MAXX = 1000
MAXN = 100000

def gen_random(n, k, maxx):
    ouf = open_output()

    print>>ouf, n, k
    s = set()
    for i in xrange(n):
        p = [randint(-maxx, maxx), randint(-maxx, maxx)]
        while str(p)[1:-1] in s:
            p = [randint(-maxx, maxx), randint(-maxx, maxx)]
        s.add(str(p)[1:-1])
        print>>ouf, p[0], p[1]

    ouf.close()

init_test_number()
random.seed(64)

for i in xrange(5):
    gen_random(randint(8, 10), randint(6, 8), 10)

for i in xrange(3):
    n = randint(100, 1000)
    gen_random(n, randint(2 * n / 3, n), MAXX)

for i in xrange(12):
    gen_random(MAXN, randint(2 * MAXN / 3, MAXN), MAXX)

