include Math
def f(a, b)
  cos = (b[0] - a[0]) / ((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2) ** 0.5
  sin = (b[1] - a[1]) / ((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2) ** 0.5
  len = ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5 / 3 ** 0.5
  #p [cos, acos(cos) * 180 / PI, (cos * cos(30.0 / 180 * PI) - sin * sin(30.0 / 180 * PI)), acos((cos * cos(30.0 / 180 * PI) - sin * sin (30.0 / 180 * PI))) * 180 / PI]
  #p [sin, asin(sin) * 180 / PI, (sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI)), asin((sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI))) * 180 / PI]
  #p len
  return [(2 * a[0] + b[0]) / 3, (2 * a[1] + b[1]) / 3], [a[0] + len * (cos * cos(30.0 / 180 * PI) - sin * sin(30.0 / 180 * PI)), a[1] + len * (sin * cos(30.0 / 180 * PI) + cos * sin(30.0 / 180 * PI))],  [(a[0] + 2 * b[0]) / 3, (a[1] + 2 * b[1]) / 3]
end
def test
  n = gets.to_i
  arr = Array.new(4 ** n + 1)
  #arr[0], arr[-1] = [BigDecimal.new("0.0"), BigDecimal.new("0.0")], [BigDecimal("100.0"), BigDecimal("0.0")]
  arr[0], arr[-1] = [0.0, 0.0], [100.0, 0.0]
  n.times do |i|
    for j in 1..4 ** i
      coord = f(arr[(j - 1) * 4 ** (n - i)], arr[j * 4 ** (n - i)])
      for k in 1..3
        if ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) % 4 == 2 and ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) > 20 and ((j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)) < 40
          #p ["k", (j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1), (j - 1) * 4 ** (n - i), j * 4 ** (n - i), arr[(j - 1) * 4 ** (n - i)], arr[j * 4 ** (n - i)]]
        end
        arr[(j - 1) * 4 ** (n - i) + k * 4 ** (n - i - 1)] = coord[k - 1]
      end
    end
  end
  arr.each{|item|
    puts item.join(" ")
  }
end
test