Rosetta Problems

Sorting a Grid

https://atcoder.jp/contests/agc037/tasks/agc037_d