ps = [[0.0, 0.0], [100.0, 0.0]]

deg = 0
PLUS_DEG = 60
MINUS_DEG = -120

def get_rad(deg)
  deg * (Math::PI / 180)
end

dirs = [0]
points = [1, -1, 1]

gets.to_i.times do
  len = (ps[1][0] - ps[0][0]) / 3
  _ps = [[0, 0]]
  dirs = dirs.inject([]) {|m, dir| m + [dir] + points }
  current_p = [0, 0]
  dirs.each do |dir|
    deg += begin
      case dir
      when 0; 0
      when 1; PLUS_DEG
      when -1; MINUS_DEG
      end
    end
    current_p[0] += len * Math.cos(get_rad(deg))
    current_p[1] += len * Math.sin(get_rad(deg))
    current_p[1] = 0.0 if current_p[1] < 0
    _ps << current_p.clone
  end
  ps = _ps.clone
end

ps.each do |line|
  puts "#{line[0]} #{line[1]}"
end