+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Time to hit the beach!\n",
+ "\n",
+ "To stop people going straight to the best sunbeds, the hotel has arranged a labyrinthine way of getting to the beach. Instead of heading straight to your chosen sunbed, you pick a lane and follow it through the maze. When you get to a cross-path, you walk along it to the other lane, then carry on down to the beach.\n",
+ "\n",
+ "This example network has six lines, numbered zero to five, and fifteen links. You start at the top and move down.\n",
+ "\n",
+ "![Example labyrinth](small-expanded-trace.svg.png)\n",
+ "\n",
+ "The dashed coloured lines show you some paths you would take going through this labyrinth to the beach. For instance, if you started in lane 1 (the red line), you would switch to lane 4 then lane 3, and you'd emerge on sunbed 3. Entering on lane 5 (the green line) would immediately switch to lane 2, then lane 0, then then lane 4, then finally back to lane 2 where they emerge. Entering on lane zero would take you all round the houses, including crossing the previous tracks, to finally end up back on lane 0.\n",
+ "\n",
+ "If you and five friends labelled yourselves `a`, `b`, `c`, `d`, `e`, `f`, your labels when you came out would be in order acfbed.\n",
+ "\n",
+ "You'd rather like to know where you and your friends are ending up on the beach, so you've got a copy of the layout plan of the labyrinth. It's given as a sequence of pairs, showing the lane to and from for each cross-path. For instance, the labyrinth above would be described as:\n",
+ "\n",
+ "```\n",
+ "(2, 5)\n",
+ "(1, 4)\n",
+ "(0, 3)\n",
+ "(0, 3)\n",
+ "(0, 5)\n",
+ "(3, 5)\n",
+ "(0, 2)\n",
+ "(3, 4)\n",
+ "(2, 4)\n",
+ "(1, 2)\n",
+ "(0, 4)\n",
+ "(1, 2)\n",
+ "(2, 4)\n",
+ "(0, 4)\n",
+ "(1, 4)\n",
+ "```\n",
+ "\n",
+ "For each pair `(a, b)`, you can assume $0 \\le a < b < n$, if there are _n_ lanes. (In other words, all lane numbers are valid, the first lane number is always less than the second, and cross-paths don't go from a lane back to the same lane.)\n",
+ "\n",
+ "# Part 1\n",
+ "\n",
+ "The full labyrinth description is given in (04-lines.txt). The labyrinth has 26 lines, labelled 0 to 25 inclusive. If you and 25 friends, labelled `a` to `z` in order, entered the labyrinth, in what order would you come out?\n",
+ "\n",
+ "(Your answer should be one string of 26 letters, without spaces or punctuation, like `acfbed` .)"
+ ]
+ },