UVA10988 From G to H and back

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1929 [PDF](https://uva.onlinejudge.org/external/109/p10988.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10988/7145ce0c5436c958ec70854f036ec22f1359ece5.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10988/d5f2d8963674c637a7417210c6e70e0fb8a94f3a.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10988/dfdd4f9d655d7b3cead187130da6f404af8cbd02.png)