def inner_prod(v0, v1):
    ans = 0
    for x0, x1 in zip(v0, v1):
        ans += x0 * x1
    return ans


def vector_add(v0, v1):
    return [x0 + x1 for x0, x1 in zip(v0, v1)]


def vector_mul(vector, scaler):
    return [scaler * x for x in vector]


def matrix_mul(matrix, vector):
    ans = []
    for row in matrix:
        ans.append(inner_prod(row, vector))
    return ans


def koch(p0, p1, max_depth, depth=0):
    from math import sin, cos, pi

    if depth == max_depth:
        return []
    R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]]
    p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3))
    p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3))
    p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1))))
    return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ]


def dfs_print(array):
    if not array:
        return
    if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child)


n = int(input())
result = [[0, 0], koch([0, 0], [100, 0], n), [100, 0]]
dfs_print(result)
 def inner_prod(v0, v1):
    ans = 0
    for x0, x1 in zip(v0, v1):
        ans += x0 * x1
    return ans inner_prod ans = 0 ans 0 for x0, x1 in zip(v0, v1):
        ans += x0 * x1
     x0 x1 zip(v0, v1) zip v0 v1 ans += x0 * x1 ans x0 * x1 x0 x1 return ans ans v0 v0 v1 v1 def vector_add(v0, v1):
    return [x0 + x1 for x0, x1 in zip(v0, v1)] vector_add x0 + x1 for x0, x1 in zip(v0, v1) for x0, x1 in zip(v0, v1) x0 x1 zip(v0, v1) zip v0 v1 for x0, x1 in zip(v0, v1) x0 + x1 x0 x1 return [x0 + x1 for x0, x1 in zip(v0, v1)] [x0 + x1 for x0, x1 in zip(v0, v1)] v0 v0 v1 v1 def vector_mul(vector, scaler):
    return [scaler * x for x in vector] vector_mul scaler * x for x in vector for x in vector x vector for x in vector scaler * x scaler x return [scaler * x for x in vector] [scaler * x for x in vector] vector vector scaler scaler def matrix_mul(matrix, vector):
    ans = []
    for row in matrix:
        ans.append(inner_prod(row, vector))
    return ans matrix_mul ans = [] ans [] for row in matrix:
        ans.append(inner_prod(row, vector))
     row matrix ans.append(inner_prod(row, vector)) ans.append ans append inner_prod(row, vector) inner_prod row vector return ans ans matrix matrix vector vector def koch(p0, p1, max_depth, depth=0):
    from math import sin, cos, pi

    if depth == max_depth:
        return []
    R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]]
    p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3))
    p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3))
    p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1))))
    return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ] koch from math import sin, cos, pi if depth == max_depth:
        return []
     depth == max_depth depth max_depth return [] [] R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]] R [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]] [cos(pi / 3), -sin(pi / 3)] cos(pi / 3) cos pi / 3 pi 3 -sin(pi / 3) sin(pi / 3) sin pi / 3 pi 3 [sin(pi / 3), cos(pi / 3)] sin(pi / 3) sin pi / 3 pi 3 cos(pi / 3) cos pi / 3 pi 3 p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3)) p2 vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3)) vector_add vector_mul(p0, 2 / 3) vector_mul p0 2 / 3 2 3 vector_mul(p1, 1 / 3) vector_mul p1 1 / 3 1 3 p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3)) p3 vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3)) vector_add vector_mul(p0, 1 / 3) vector_mul p0 1 / 3 1 3 vector_mul(p1, 2 / 3) vector_mul p1 2 / 3 2 3 p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1)))) p4 vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1)))) vector_add p2 matrix_mul(R, vector_add(p3, vector_mul(p2, -1))) matrix_mul R vector_add(p3, vector_mul(p2, -1)) vector_add p3 vector_mul(p2, -1) vector_mul p2 -1 return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ] [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ] koch(p0, p2, max_depth, depth + 1) koch p0 p2 max_depth depth + 1 depth 1 p2 koch(p2, p4, max_depth, depth + 1) koch p2 p4 max_depth depth + 1 depth 1 p4 koch(p4, p3, max_depth, depth + 1) koch p4 p3 max_depth depth + 1 depth 1 p3 koch(p3, p1, max_depth, depth + 1) koch p3 p1 max_depth depth + 1 depth 1 p0 p0 p1 p1 max_depth max_depth depth=0 depth 0 def dfs_print(array):
    if not array:
        return
    if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child) dfs_print if not array:
        return
     not array array return if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child) isinstance(array[0], int) or isinstance(array[0], float) isinstance(array[0], int) isinstance array[0] array 0 int isinstance(array[0], float) isinstance array[0] array 0 float print(*array) print *array array for child in array:
            dfs_print(child) child array dfs_print(child) dfs_print child array array n = int(input()) n int(input()) int input() input result = [[0, 0], koch([0, 0], [100, 0], n), [100, 0]] result [[0, 0], koch([0, 0], [100, 0], n), [100, 0]] [0, 0] 0 0 koch([0, 0], [100, 0], n) koch [0, 0] 0 0 [100, 0] 100 0 n [100, 0] 100 0 dfs_print(result) dfs_print result def vector_mul(vector, scaler):
    return [scaler * x for x in vector] def vector_mul(vector, scaler):
    return [scaler * x for x in vector] vector_mul n = int(input()) int(input()) n def matrix_mul(matrix, vector):
    ans = []
    for row in matrix:
        ans.append(inner_prod(row, vector))
    return ans def matrix_mul(matrix, vector):
    ans = []
    for row in matrix:
        ans.append(inner_prod(row, vector))
    return ans matrix_mul def inner_prod(v0, v1):
    ans = 0
    for x0, x1 in zip(v0, v1):
        ans += x0 * x1
    return ans def inner_prod(v0, v1):
    ans = 0
    for x0, x1 in zip(v0, v1):
        ans += x0 * x1
    return ans inner_prod def vector_add(v0, v1):
    return [x0 + x1 for x0, x1 in zip(v0, v1)] def vector_add(v0, v1):
    return [x0 + x1 for x0, x1 in zip(v0, v1)] vector_add def dfs_print(array):
    if not array:
        return
    if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child) def dfs_print(array):
    if not array:
        return
    if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child) dfs_print def koch(p0, p1, max_depth, depth=0):
    from math import sin, cos, pi

    if depth == max_depth:
        return []
    R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]]
    p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3))
    p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3))
    p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1))))
    return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ] def koch(p0, p1, max_depth, depth=0):
    from math import sin, cos, pi

    if depth == max_depth:
        return []
    R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]]
    p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3))
    p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3))
    p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1))))
    return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ] koch result = [[0, 0], koch([0, 0], [100, 0], n), [100, 0]] [[0, 0], koch([0, 0], [100, 0], n), [100, 0]] result
def inner_prod(v0, v1):
    ans = 0
    for x0, x1 in zip(v0, v1):
        ans += x0 * x1
    return ans


def vector_add(v0, v1):
    return [x0 + x1 for x0, x1 in zip(v0, v1)]


def vector_mul(vector, scaler):
    return [scaler * x for x in vector]


def matrix_mul(matrix, vector):
    ans = []
    for row in matrix:
        ans.append(inner_prod(row, vector))
    return ans


def koch(p0, p1, max_depth, depth=0):
    from math import sin, cos, pi

    if depth == max_depth:
        return []
    R = [[cos(pi / 3), -sin(pi / 3)], [sin(pi / 3), cos(pi / 3)]]
    p2 = vector_add(vector_mul(p0, 2 / 3), vector_mul(p1, 1 / 3))
    p3 = vector_add(vector_mul(p0, 1 / 3), vector_mul(p1, 2 / 3))
    p4 = vector_add(p2, matrix_mul(R, vector_add(p3, vector_mul(p2, -1))))
    return [
        koch(p0, p2, max_depth, depth + 1),
        p2,
        koch(p2, p4, max_depth, depth + 1),
        p4,
        koch(p4, p3, max_depth, depth + 1),
        p3,
        koch(p3, p1, max_depth, depth + 1),
    ]


def dfs_print(array):
    if not array:
        return
    if isinstance(array[0], int) or isinstance(array[0], float):
        print(*array)
    else:
        for child in array:
            dfs_print(child)


n = int(input())
result = [[0, 0], koch([0, 0], [100, 0], n), [100, 0]]
dfs_print(result)

