import scala.io.StdIn.readInt

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)

  def main(args:Array[String]) = {
    val n = readInt
    var list = IndexedSeq((0D,0D),(100D,0D))
    (1 to n).foreach { _=>
      list = for{
        k<-0 until list.length-1; i = list(k); j = list(k+1)
        p1 = (i._1*2/3+j._1/3,i._2*2/3+j._2/3)
        p2 = (i._1/3+j._1*2/3,i._2/3+j._2*2/3)
        x = (p2._1-p1._1)*c-(p2._2-p1._2)*s+p1._1
        y = (p2._1-p1._1)*s+(p2._2-p1._2)*c+p1._2
        list2 = if(k==0) Iterator(i,p1,(x,y),p2,j) else Iterator(p1,(x,y),p2,j)
        q<-list2
      } yield q
    }

    for((i,j)<-list) printf("%.8f %.8f\n",i,j)
  }
}