import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def prime_table(N): is_prime = np.zeros(N, np.int64) is_prime[2:3] = 1 is_prime[3::2] = 1 for p in range(3, N, 2): if p * p >= N: break if is_prime[p]: is_prime[p * p::p + p] = 0 return is_prime, np.where(is_prime)[0] _, primes = prime_table(10**4) N = int(read()) def main(N): p = primes[primes > N][0] x = np.arange(N) y = (x * x) % p return x, y x, y = main(N) for a, b in zip(x, y): print(a, b)