P7369 [COCI 2018/2019 #4] Elder
Description
After watching eight Harry Potter movies in a week, Nikola realized how powerful the Elder Wand is. If the Elder Wand currently serves wizard A, and wizard A is defeated by wizard B, then the Elder Wand will start serving wizard B.
Now several wizards will have $N$ duels. Given the wizard the Elder Wand initially serves and the results of the $N$ duels, find:
1. After the $N$ duels, who the Elder Wand serves.
2. How many wizards has the Elder Wand served in total?
Input Format
The first line contains one uppercase letter, representing the wizard the Elder Wand initially serves.
The second line contains an integer $N$, representing the number of duels.
Each of the next $N$ lines contains two uppercase letters $Z_1$ and $Z_2$ separated by a space, meaning that in the $i$-th duel, wizard $Z_1$ defeated wizard $Z_2$.
Output Format
Output one uppercase letter on the first line, representing the answer to question 1.
Output one integer on the second line, representing the answer to question 2.
Explanation/Hint
#### Explanation for Sample 1
The Elder Wand initially serves wizard A. After the first duel, the Elder Wand starts serving B. After the second duel, the Elder Wand starts serving C. The third duel after that does not affect who the Elder Wand serves.
#### Constraints
For $100\%$ of the testdata, $1 \le N \le 100$.
#### Scoring
In each test case, the first line is worth $2$ points and the second line is worth $3$ points, for a total of $5$ points per test case. If you only want to get the points for one line, please output any number on the other line as well; otherwise, it cannot be judged correctly.
A Special Judge is needed for scoring; see the attachment for details.
#### Notes
**The score of this problem follows the original COCI setting, with a full score of $50$.**
**Translated from [COCI2018-2019](https://hsin.hr/coci/archive/2018_2019/) [CONTEST #4](https://hsin.hr/coci/archive/2018_2019/contest4_tasks.pdf) _T1 Elder_.**
Translated by ChatGPT 5