import math

def RotationMatrix(theta):
    '''
    theta in degree
    '''
    c = math.cos(theta*math.pi/180)
    s = math.sin(theta*math.pi/180)
    mat = [[c,-s],[s,c]]
    return mat

def Rotate60(vec):
    mat = RotationMatrix(60)
    result_vec = []
    result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1])
    result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1])
    return result_vec

def get_points(a_vec,b_vec):
    s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)]
    t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)]
    u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)]
    u_vec = Rotate60(u_vec)
    u_vec = [s+u for (s,u) in zip(s_vec,u_vec)]
    return s_vec, t_vec, u_vec

def get_koch(A, n,cnt, a_vec,b_vec):
    if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
        
n = int(input())
cnt = 0
a_vec = [0,0]
b_vec = [100,0]
A = []
A.append(a_vec)
get_koch(A, n,cnt, a_vec,b_vec)
A.append(b_vec)
for a in A:
    print(*a) import math math def RotationMatrix(theta):
    '''
    theta in degree
    '''
    c = math.cos(theta*math.pi/180)
    s = math.sin(theta*math.pi/180)
    mat = [[c,-s],[s,c]]
    return mat RotationMatrix '''
    theta in degree
    ''' c = math.cos(theta*math.pi/180) c math.cos(theta*math.pi/180) math.cos math cos theta*math.pi/180 theta*math.pi theta math.pi math pi 180 s = math.sin(theta*math.pi/180) s math.sin(theta*math.pi/180) math.sin math sin theta*math.pi/180 theta*math.pi theta math.pi math pi 180 mat = [[c,-s],[s,c]] mat [[c,-s],[s,c]] [c,-s] c -s s [s,c] s c return mat mat theta theta def Rotate60(vec):
    mat = RotationMatrix(60)
    result_vec = []
    result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1])
    result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1])
    return result_vec Rotate60 mat = RotationMatrix(60) mat RotationMatrix(60) RotationMatrix 60 result_vec = [] result_vec [] result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1]) result_vec.append result_vec append mat[0][0]*vec[0] + mat[0][1]*vec[1] mat[0][0]*vec[0] mat[0][0] [0] mat 0 0 vec[0] vec 0 mat[0][1]*vec[1] mat[0][1] [0] mat 0 1 vec[1] vec 1 result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1]) result_vec.append result_vec append mat[1][0]*vec[0] + mat[1][1]*vec[1] mat[1][0]*vec[0] mat[1][0] [1] mat 1 0 vec[0] vec 0 mat[1][1]*vec[1] mat[1][1] [1] mat 1 1 vec[1] vec 1 return result_vec result_vec vec vec def get_points(a_vec,b_vec):
    s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)]
    t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)]
    u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)]
    u_vec = Rotate60(u_vec)
    u_vec = [s+u for (s,u) in zip(s_vec,u_vec)]
    return s_vec, t_vec, u_vec get_points (2*a+b)/3 for (a,b) in zip(a_vec, b_vec) for (a,b) in zip(a_vec, b_vec) (a,b) a b zip(a_vec, b_vec) zip a_vec b_vec for (a,b) in zip(a_vec, b_vec) (2*a+b)/3 2*a+b 2*a 2 a b 3 s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)] s_vec [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)] (a+2*b)/3 for (a,b) in zip(a_vec, b_vec) for (a,b) in zip(a_vec, b_vec) (a,b) a b zip(a_vec, b_vec) zip a_vec b_vec for (a,b) in zip(a_vec, b_vec) (a+2*b)/3 a+2*b a 2*b 2 b 3 t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)] t_vec [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)] (b-a)/3 for (a,b) in zip(a_vec,b_vec) for (a,b) in zip(a_vec,b_vec) (a,b) a b zip(a_vec,b_vec) zip a_vec b_vec for (a,b) in zip(a_vec,b_vec) (b-a)/3 b-a b a 3 u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)] u_vec [(b-a)/3 for (a,b) in zip(a_vec,b_vec)] u_vec = Rotate60(u_vec) u_vec Rotate60(u_vec) Rotate60 u_vec s+u for (s,u) in zip(s_vec,u_vec) for (s,u) in zip(s_vec,u_vec) (s,u) s u zip(s_vec,u_vec) zip s_vec u_vec for (s,u) in zip(s_vec,u_vec) s+u s u u_vec = [s+u for (s,u) in zip(s_vec,u_vec)] u_vec [s+u for (s,u) in zip(s_vec,u_vec)] return s_vec, t_vec, u_vec return s_vec, t_vec, u_vec s_vec t_vec u_vec a_vec a_vec b_vec b_vec def get_koch(A, n,cnt, a_vec,b_vec):
    if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
         get_koch if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
         cnt >= n cnt n return cnt += 1 cnt 1 s_vec, t_vec, u_vec = get_points(a_vec,b_vec) s_vec get_points(a_vec,b_vec) get_points a_vec b_vec t_vec u_vec get_koch(A, n,cnt, a_vec, s_vec) get_koch A n cnt a_vec s_vec A.append(s_vec) A.append A append s_vec get_koch(A, n,cnt, s_vec, u_vec) get_koch A n cnt s_vec u_vec A.append(u_vec) A.append A append u_vec get_koch(A, n,cnt, u_vec, t_vec) get_koch A n cnt u_vec t_vec A.append(t_vec) A.append A append t_vec get_koch(A, n,cnt, t_vec, b_vec) get_koch A n cnt t_vec b_vec A A n n cnt cnt a_vec a_vec b_vec b_vec n = int(input()) n int(input()) int input() input cnt = 0 cnt 0 a_vec = [0,0] a_vec [0,0] 0 0 b_vec = [100,0] b_vec [100,0] 100 0 A = [] A [] A.append(a_vec) A.append A append a_vec get_koch(A, n,cnt, a_vec,b_vec) get_koch A n cnt a_vec b_vec A.append(b_vec) A.append A append b_vec for a in A:
    print(*a) a A print(*a) print *a a n = int(input()) int(input()) n def Rotate60(vec):
    mat = RotationMatrix(60)
    result_vec = []
    result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1])
    result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1])
    return result_vec def Rotate60(vec):
    mat = RotationMatrix(60)
    result_vec = []
    result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1])
    result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1])
    return result_vec Rotate60 def get_points(a_vec,b_vec):
    s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)]
    t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)]
    u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)]
    u_vec = Rotate60(u_vec)
    u_vec = [s+u for (s,u) in zip(s_vec,u_vec)]
    return s_vec, t_vec, u_vec def get_points(a_vec,b_vec):
    s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)]
    t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)]
    u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)]
    u_vec = Rotate60(u_vec)
    u_vec = [s+u for (s,u) in zip(s_vec,u_vec)]
    return s_vec, t_vec, u_vec get_points a_vec = [0,0] [0,0] a_vec def get_koch(A, n,cnt, a_vec,b_vec):
    if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
         def get_koch(A, n,cnt, a_vec,b_vec):
    if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
         get_koch b_vec = [100,0] [100,0] b_vec def RotationMatrix(theta):
    '''
    theta in degree
    '''
    c = math.cos(theta*math.pi/180)
    s = math.sin(theta*math.pi/180)
    mat = [[c,-s],[s,c]]
    return mat def RotationMatrix(theta):
    '''
    theta in degree
    '''
    c = math.cos(theta*math.pi/180)
    s = math.sin(theta*math.pi/180)
    mat = [[c,-s],[s,c]]
    return mat RotationMatrix A = [] [] A cnt = 0 0 cnt
import math

def RotationMatrix(theta):
    '''
    theta in degree
    '''
    c = math.cos(theta*math.pi/180)
    s = math.sin(theta*math.pi/180)
    mat = [[c,-s],[s,c]]
    return mat

def Rotate60(vec):
    mat = RotationMatrix(60)
    result_vec = []
    result_vec.append(mat[0][0]*vec[0] + mat[0][1]*vec[1])
    result_vec.append(mat[1][0]*vec[0] + mat[1][1]*vec[1])
    return result_vec

def get_points(a_vec,b_vec):
    s_vec = [(2*a+b)/3 for (a,b) in zip(a_vec, b_vec)]
    t_vec = [(a+2*b)/3 for (a,b) in zip(a_vec, b_vec)]
    u_vec = [(b-a)/3 for (a,b) in zip(a_vec,b_vec)]
    u_vec = Rotate60(u_vec)
    u_vec = [s+u for (s,u) in zip(s_vec,u_vec)]
    return s_vec, t_vec, u_vec

def get_koch(A, n,cnt, a_vec,b_vec):
    if cnt >= n:
        return
    else:
        cnt += 1
        s_vec, t_vec, u_vec = get_points(a_vec,b_vec)
        get_koch(A, n,cnt, a_vec, s_vec)
        A.append(s_vec)
        get_koch(A, n,cnt, s_vec, u_vec)
        A.append(u_vec)
        get_koch(A, n,cnt, u_vec, t_vec)
        A.append(t_vec)
        get_koch(A, n,cnt, t_vec, b_vec)
        
        
n = int(input())
cnt = 0
a_vec = [0,0]
b_vec = [100,0]
A = []
A.append(a_vec)
get_koch(A, n,cnt, a_vec,b_vec)
A.append(b_vec)
for a in A:
    print(*a)
