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

typedef struct Point{
  double x, y;
} Point;

void koch(int n, Point p1, Point p2){
  if (n == 0) {return;}

  Point s, t, u;
  double an = M_PI * 60.0 / 180.0;

// p1, p2 から s, t, u を計算

  s.x = (2.0*p1.x + 1.0*p2.x) / 3.0;
  s.y = (2.0*p1.y + 1.0*p2.y) / 3.0;
  t.x = (1.0*p1.x + 2.0*p2.x) / 3.0;
  t.y = (1.0*p1.y + 2.0*p2.y) / 3.0;
  u.x = (t.x - s.x)*cos(an) - (t.y - s.y)*sin(an) + s.x;
  u.y = (t.x - s.x)*sin(an) + (t.y - s.y)*cos(an) + s.y;

  koch(n - 1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, p2);
}
