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

# Argument handling consistent with gen.toml testcases
if len(sys.argv) < 7:
    print("Usage: gen_q_equal_1_k_equal_2.py <n> <q> <maxa> <k> <type> <seed> [distinct_a]")
    sys.exit(1)

n = int(sys.argv[1])
q = int(sys.argv[2]) # should be 1
maxa = int(sys.argv[3])
k = int(sys.argv[4]) # should be 2
type_str = sys.argv[5] 
seed = int(sys.argv[6])

random.seed(seed)

print(n, q)

if type_str == "break_a_equal_1_yes":
    # Cases when n < k and answer is YES
    assert n < k
    a = random.randint(1, maxa)
    A = [a if a % k == 0 else a - (a % k)]
elif type_str == "break_a_equal_1_no":
    # Cases where n >= k but the answer is NO.
    assert n >= k
    val = maxa if maxa % 2 != 0 else maxa - 1
    A = [val]
    v = (val + 1) // 2
    for _ in range(n - 1):
        A.append(random.randint(1, max(1, v - 1)))
elif type_str == "break_n_equal_1":
    # Cases where max(A) % k != 0 but the answer is YES.
    val = maxa if maxa % 2 != 0 else maxa - 1
    assert n >= 2
    A = [val, val]
    for _ in range(n - 2):
        A.append(random.randint(1, val - 1))
elif type_str == "large_a":
    # Large numbers for a_i
    val = random.randint(maxa // 2, maxa)
    A = [val]
    v = (val + 1) // 2
    for _ in range(n - 1):
        A.append(random.randint(1, max(1, v - 1)))
else:
    # Default random
    A = [random.randint(1, maxa) for _ in range(n)]

print(*A)

for _ in range(q):
    print(k)
