//http://qa->itmedia->co->jp/qa9016289->html

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

struct _pt{
    float x;
    float y;

    struct _pt *n;
};
typedef struct _pt point;

int koch( point *p ){

    
    point *p1 = p;
    point *p2 = p->n;


    point *pa, *pb, *pc;

    pa = (point*)malloc(sizeof(point));
    pb = (point*)malloc(sizeof(point));
    pc = (point*)malloc(sizeof(point));

    p1->n=pa; pa->n=pc; pc->n=pb; pb->n=p2;

    pa->x = (p1->x*2+p2->x)/3; pa->y = (p1->y*2+p2->y)/3;
    pb->x = (p1->x+p2->x*2)/3; pb->y = (p1->y+p2->y*2)/3;
    
    //printf( "(%.2f,%.2f) ",  pa->x, pa->y);
    //printf( "(%.2f,%.2f)\n",  pb->x, pb->y);

    float ab = sqrt( pow(pa->x-pb->x,2) + pow(pa->y-pb->y,2) ); 
    float c = atan2((pb->y-pa->y),(pb->x-pa->x));
    //printf( " ab = %f\n", ab );
    //printf( " c = %f\n", c );
        
    //printf( " %.2f %.2f\n", cos(c), sin(c) );
    //printf( " %.2f %.2f\n", sqrt(3*cos(c)), sqrt(3*sin(c)) );
    
    pc->x = pa->x + ab*(cos(c)-sqrt(3)*sin(c))/2;
    pc->y = pa->y + ab*(sin(c)+sqrt(3)*cos(c))/2;
    //printf( " (%.2f,%.2f)\n", pc->x, pc->y );

    return 0;
}




int main(){

    int n, i;
    point *pt, *pt1, *pt2, *node;

    pt = (point*)malloc(sizeof(pt));
    node = pt;
    pt->x=0; pt->y=0;
    pt->n = (point*)malloc(sizeof(pt));
    pt = pt->n;
    pt->x=100; pt->y=0; pt->n=NULL;

    scanf( "%d", &n );



    for( i=0; i<n; i++ ){
        pt1 = node;
        while( pt1->n != NULL ){
            pt2 = pt1->n;
            koch( pt1 );
            pt1 = pt2;
        }
    }
    

    while( node != NULL ){

        printf( "%f %f\n", node->x, node->y );

        pt = node->n;
        free(node);
        node = pt;
    }

}
