from sys import argv

# Function to verbal names of Finnish numbers up to 10^12 - 1.
# If run on the command line, takes an integer parameter and prints terms in
# the OEIS b-file format from zero up to the given number.

# Requires Python 3 (you should not be running Python 2.x in the year 2020 anyway).

INDIVIDUALS = {
    0 : "", # zero is set to empty string here for convenience below
    1 : "yksi",
    2 : "kaksi",
    3 : "kolme",
    4 : "neljä",
    5 : "viisi",
    6 : "kuusi",
    7 : "seitsemän",
    8 : "kahdeksan",
    9 : "yhdeksän",
    10 : "kymmenen",
    100 : "sata",
    1000 : "tuhat",
    1000000 : "miljoona",
    1000000000 : "miljardi"
}

SUFFIXES = ["miljardia", "miljoonaa", "tuhatta", ""]

def numbername(n):
    """Return the Finnish name of the number n, up to 10**12 - 1."""
    if n < 0 or n > 999999999999:
        raise ValueError("Cannot compute for n less than zero or greater than 10^12 - 1.")
    elif n == 0:
        return "nolla"
    elif n in INDIVIDUALS.keys():
        return INDIVIDUALS[n]
    elif n < 20:
        second_digit = int(str(n)[1])
        return "{}toista".format(INDIVIDUALS[second_digit])
    elif n < 100:
        s = str(n)
        first_digit = int(s[0])
        second_digit = int(s[1])
        return "{}kymmentä{}".format(INDIVIDUALS[first_digit], INDIVIDUALS[second_digit]) 
    elif n < 200:
        return "sata{}".format(numbername(n-100))
    elif n < 1000:
        first_digit = int(str(n)[0])
        if n % 100 == 0:
            return "{}sataa".format(numbername(first_digit))
        return "{}sataa{}".format(numbername(first_digit), numbername(n-100*first_digit))

    else:
        s = "{:012d}".format(n)
        parts = [int(s[3*k:3*k+3]) for k in range(4)]
        result = []
        for k, part in enumerate(parts):
            if part == 0:
                result.append("")
            elif part == 1:
                result.append(numbername(part*10**(9-3*k)))
            else:
                result.append("{}{}".format(numbername(part), SUFFIXES[k]))
        return "".join(result)

if __name__=="__main__":
    N = int(argv[1])
    for i in range(N+1):
        print("{} {}".format(i, len(numbername(i))))