Company: Algouniversity_6_Jan
Difficulty: medium
Kid Photography Problem Description Genie is trying to take a perfect photograph of his $N$ kids lined up in a very specific order $A[1 \dots N]$ for their annual family album. But his mischievous kids love to mess around! Every time Genie counts to three and clicks the camera, exactly one kid might sneak out of their position and quickly jump somewhere else in the line — just for fun. This happens five times, resulting in five photos. Thankfully, each time only one kid pulls this trick (or none at all), and every kid promises to only misbehave once across the five photos. Each of the 5 photos shows a lineup that differs from the original order $A$ by at most one move. A kid who actively moves in one photo remains still in all other photos. Your task is to help Genie recover the original intended order $A$ from the 5 chaotic photos. Input Format The first line contains a single integer $N$ ($1 \le N \le 20,000$): the number of kids. The next 5 lines each contain $N$ space-separated int