Rosetta Problems

The baggage

https://atcoder.jp/contests/abc226/tasks/abc226_g