from os import mkdir
from random import *

seed('pwgen')

MAXN = 100

logger = lambda s : print(s)

class Printer:
    def __init__(self, path):
        self.path = "../" + path
        self.tests = 0
        try:
            logger("Creating directory %s"%self.path)
            mkdir(self.path)
        except:
            logger("...Directory already exists")

    def print(self, n, a, b, c):
        self.tests += 1
        p = self.path + "/" + "%02d"%self.tests
        logger("Printing test %s"%p)
        out = open(p, "w")
        print(n, file=out)
        print(a, b, c, file=out)

tests = Printer("tests")

tests.print(8, 2, 5, 1) # PasSw0rd
tests.print(1, 1, 0, 0)
tests.print(1, 0, 1, 0)
tests.print(1, 0, 0, 1)
tests.print(2, 1, 0, 0)
tests.print(2, 0, 1, 0)
tests.print(2, 0, 0, 1)
tests.print(10, 3, 3, 3)
tests.print(MAXN, MAXN, 0, 0)
tests.print(MAXN, 0, MAXN, 0)
tests.print(MAXN, 0, 0, MAXN)
tests.print(MAXN, MAXN // 3, MAXN // 3, MAXN // 3)
tests.print(1, 0, 0, 0)
tests.print(MAXN, 0, 0, 0)
tests.print(MAXN, 1, 1, 1)
tests.print(MAXN, 1, MAXN // 2, 1)

for i in range(5):
    n = randint(4, MAXN)
    ab = randint(2, n // 2)
    a = randint(1, ab)
    c = randint(1, n - ab)
    tests.print(n, a, ab - a, c)
