Like most high security research facilities, many of the rooms in the Cushing and Fitzpatrick require a secret number code to enter. Usually, a single passcode is given to all the users of a particular room. Unfortunately, in this day and age of camera phones and drones, it is easy for intruders to snoop on people entering in the passcode 1.

In an effort to thwart passcode snoopers, the building security team has implemented a new passcode mechanism: instead of entering the whole passcode, the user must enter in three random numbers from the original door code. For instance, if the passcode was `2468135`, the user may be asked to enter in the `2nd`, `4th`, and `5th` numbers: `481`. This shorter sequence (`2nd`, `4th`, `5th`) changes each time, so just watching the someone enter in the door code will not guarantee entry to the snooper. Moreover, it helps prevent divulging the complete passcode.

Being the black hat that you are, however, you decide that this security arrangement is weak and plan on cracking the code to the instructor's office 2. To do so, you have carefully monitored a series of successful entries and recorded them in a text file. Knowing that the three random numbers are always asked for in order and that the digits in the passcode are unique (due to limitations to the security software), your next step is to analyze these entries and produce the original passcode.

## Input¶

You will be given a series of successful entries where each entry is a three digit sequence:

```352
154
542
315
152
```

## Output¶

The passcode for the above input is:

### Example Output¶

```31542
```

#### Algorithmic Complexity¶

For each input test case, your solution should have the following targets:

 Time Complexity `O(V+E)`, where `V` is the number of digits in the passcode and `E` is the number of edges in DAG. Space Complexity `O(V)`, where `V` is the number of digits in the passcode.

Your solution may be below the targets, but it should not exceed them.

## Submission¶

```\$ cd path/to/cse-30872-fa21-assignments     # Go to assignments repository
\$ git checkout master                       # Make sure we are on master
\$ git pull --rebase                         # Pull any changes from GitHub

\$ git checkout -b challenge18               # Create and checkout challenge18 branch

\$ \$EDITOR challenge18/program.cpp           # Edit your code

\$ git commit -m "challenge18: done"         # Commit your changes

\$ git push -u origin challenge18            # Send changes to GitHub
```

To check your code, you can use the `.scripts/check.py` script or curl:

```\$ .scripts/check.py
Checking challenge18 program.cpp ...
Result Success
Time 0.02
Score 6.00 / 6.00

\$ curl -F source=@challenge18/program.cpp https://dredd.h4x0r.space/code/cse-30872-fa21/challenge18
{"result": "Success", "score": 6, "time": 0.03185953369140625, "value": 6, "status": 0}
```

#### Pull Request¶

Once you have committed your work and pushed it to GitHub, remember to create a pull request and assign it to the appropriate teaching assistant from the Reading 09 TA List.

1. Or people just text it to everyone or write it on the whiteboard.

2. Because like my door is never open and stuff.