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

# Argument handling
if len(sys.argv) < 6:
    print("Usage: gen_nocount.py <n> <q> <maxa> <maxk> <seed>")
    sys.exit(1)

n = int(sys.argv[1])
q = int(sys.argv[2])
maxa = int(sys.argv[3])
maxk = int(sys.argv[4])
seed = int(sys.argv[5])

random.seed(seed)

# We want k such that k <= maxa and a_max % k != 0
# To catch the 'nocount' bug, we want multiple a_max elements to contribute to the same k.

print(n, q)
max_a = random.randint(maxa // 2, maxa)

k = random.randint(2, min(maxk, max_a // 2))
if max_a % k == 0:
    max_a += 1

t = max_a // k + 1

b = max_a % t # 

# print 3 a_max followed by n - 3 small random int
a = []
for _ in range(3):
    a.append(max_a)

for _ in range(n - 3):
    a.append(1)

print(*a)

for i in range(q):
    c = random.randint(0, 4)
    if i == 0 or c == 0:
        print(k)
    else:
        print(1)


