Rosetta Problems

Strange Sorting

https://atcoder.jp/contests/agc014/tasks/agc014_f