def triangler(left, right)
  mid = (right - left) * Complex(Math.cos(Math::PI/3.0), Math.sin(Math::PI/3.0)) + left
  [left, mid, right]
end

def div3(left, right)
  l2 = left + (right - left) / 3.0
  r2 = left + (right - left) * 2.0 / 3.0
  [left, *triangler(l2, r2) , right]
end

points = Complex(0.0, 0.0), Complex(100.0, 0.0)
n = gets.to_i

n.times do
  tmp = []
  loop do
    l = points.shift
    if points.empty?
      tmp << l
      break
    end
    tmp << div3(l, points[0])[0..3]
  end
  points = tmp.flatten
end

points.each do |p|
  puts p.rectangular.map(&:to_s).join(' ')
end
