class Point
  ANGLE = Math::PI * 60 / 180

  attr_reader :x, :y
  def initialize(x, y)
    @x = x.to_f
    @y = y.to_f
  end

  def make_split_points(other)
    wx = (other.x - x) / 3.0
    wy = (other.y - y) / 3.0

    left = Point.new(x + wx, y + wy)
    right = Point.new(x + wx * 2, y + wy * 2)
    middle = left.make_vertex(right)
    [left, middle, right]
  end

  def make_vertex(other)
    dx = other.x - x
    dy = other.y - y

    dist = Math.sqrt(dx**2 + dy**2)
    rotate = Math.atan2(dy, dx) + ANGLE

    Point.new(@x + dist * Math.cos(rotate), @y + dist * Math.sin(rotate))
  end

  def to_s
    "#{@x} #{@y}"
  end
end

def koch(points)
  result = []
  points.each_with_index do |p1, i|
    result << p1

    break if i == points.size - 1

    p2 = points[i + 1]
    result.concat(p1.make_split_points(p2))
  end
  result
end

n = gets.to_i

points = []
points << Point.new(0, 0)
points << Point.new(100, 0)

n.times do
  points = koch(points)
end

points.each{|p| puts p}