@staticmethod
def c():
    n = (int(sys.stdin.readline().rstrip()) % 30)
    res = list(range(1, 7))
    for i in range(n):
        i %= 5
        (res[i], res[(i + 1)]) = (res[(i + 1)], res[i])
    print(*res, sep='')
@staticmethod
def c():
    n = (int(sys.stdin.readline().rstrip()) % 30)
    res = list(range(1, 7))
    for i in range(n):
        i %= 5
        (res[i], res[(i + 1)]) = (res[(i + 1)], res[i])
    print(*res, sep=)