#include <iostream>

using namespace std;
int a, b, aux, nr1, nr2, x;
int main () {
    cin>>x>>a>>b;
    if (a > b) {
        aux = a;
        a = b;
        b = aux;
    }

    nr1 = b/x - (a-1)/x;

    cin>>x>>a>>b;
    if (a > b) {
        aux = a;
        a = b;
        b = aux;
    }

    nr2 = b/x - (a-1)/x;

    if (nr1 > nr2)
        cout<<"Ioana "<<nr1;
    else
        if (nr1 < nr2)
            cout<<"Maria "<<nr2;
        else
            cout<<"Egalitate "<<nr1;

    return 0;
}
