Task: Program Execution
Input (English): 4, 4, ['3797', 'S', 'K', 'm', 'M', 'J']
Output (English): m