Rosetta Problems

BSGS

https://www.acwing.com/problem/content/3127