Under construction

Still being built. Things may change

Average scores

Time limit1sMemory limit1024 MB

Summary
Given each playthrough's player and points, print M, J, or V for whose average score is higher, or whether the averages are equal.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Mari and Jüri are playing a computer game and arguing about whose average score is higher. Write a program that decides, based on their results, whose average score is higher.

Input

The first line contains an integer NN (1≤N≤500 0001 \le N \le 500\,000). Each of the following NN lines contains a capital letter M or J and an integer PP (0≤P≤10 0000 \le P \le 10\,000), separated by a space. M stands for Mari, J for Jüri, and PP is the number of points that player scored in one playthrough.

Output

Print M if Mari's average score is higher, J if Jüri's average score is higher, or V if the two averages are equal. If a player has not played the game at all, that player's average score is 00.

Examples1

  1. Example 1

    Input
    5
    M 6000
    J 7000
    M 9545
    M 4500
    J 3200
    
    Expected output
    M