Task: Program Execution
Input (English): n, n, Q, 3813, 6783, A, Q, 5055, U, 9105, z
Output (English): 3813, 6783, 5055, 9105