include Math
def koch_Curve(pos)
  list = []
  0.upto(pos.size-2){|i|
    s = [pos[i][0]+(pos[i+1][0] - pos[i][0]) / 3.0, pos[i][1]+(pos[i+1][1] - pos[i][1]) / 3.0]
    t = [pos[i][0]+(pos[i+1][0] - pos[i][0]) / 1.5, pos[i][1]+(pos[i+1][1] - pos[i][1]) / 1.5]
    v = [t[0]-s[0], t[1] - s[1]]
    u = [s[0]+v[0] * $cos - v[1] * $sin, s[1]+v[0] * $sin + v[1] * $cos]
    list += [pos[i], s, u, t]
  }
  list += [pos[pos.size-1]]
  return list
end

$sin = sqrt(3.0)/2.0
$cos = 1.0/2.0

pos = [[0,0],[100,0]]
gets.to_i.times{
  pos = koch_Curve(pos)
}
pos.each{|p|
  printf "%f %f\n", p[0],p[1]
}