#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    freopen("denisov.in", "r", stdin);
    freopen("denisov.out", "w", stdout);
    int n;
    cin >> n;
    string ans = "Denisov";
    string gr = "Russia";
    int ma = -1;
    for (int i = 0; i < n; i++)
    {
        string na, s;
        int z;
        cin >> z >> na >> s;
        if (s == gr && z > ma)
        {
            ma = z;
            ans = na;
        }
    }
    cout << ans << endl;
}