Task: Program Execution
Input (English): j, 9777, i, 3891, 147, 4275, 4871, N, D, Q, 2987
Output (English): 9777, 3891, 147, 4275, 4871, 2987