#include <fstream>
#include <cmath>
using namespace std;

struct point
{
  double x,y;
};

void Koch(point A, point B, int n)
{
  if (n == 0)
  {
    cout << A.x << '\t' << A.y << endl;
    cout << B.x << '\t' << B.y << endl;
  }
  else
  {
    point C, D, E;
    C.x = 2.0/3*A.x + 1.0/3*B.x;
    C.y = 2.0/3*A.y + 1.0/3*B.y;

    D.x = 1.0/3*A.x + 2.0/3*B.x;
    D.y = 1.0/3*A.y + 2.0/3*B.y;

    double a = atan((D.y - C.y)/(D.x - C.x));
    double d = sqrt((D.y - C.y)*(D.y - C.y) + (D.x - C.x)*(D.x - C.x));
    cerr << d << endl;
    E.x = C.x + d*cos(a + 3.14159/3);
    E.y = C.y + d*sin(a + 3.14159/3);
    
    Koch(A,C,n-1);
    Koch(C,E,n-1);
    Koch(E,D,n-1);
    Koch(D,B,n-1);
  }
}

int main()
{
  point A, B;
  A.x = 0;
  A.y = 0;
  B.x = 1;
  B.y = 0;
  Koch(A,B,1);
  
  return 0;
}