Task: Program Execution
Input (English): 3, 5, ['P', '8549', '3475', '517', 'X', '8059', 'z', 'g', '1049', 'M', 'P', '5791', '7901', '4165', 'Z']
Output (English): 3475, g, 7901