#include <iostream>

using namespace std;


int main()
{
    int x, y, a, b, c, d, k=0, p=0, aux, i;
    cin>>x>>a>>b;
    cin>>y>>c>>d;
    if(a>b)
        aux=a, a=b, b=aux;
    if(c>d)
        aux=c, c=d, d=aux;
    for(i=a; i<=b; i++)
        if(i%x==0)k++;
    for(i=c; i<=d; i++)
        if(i%y==0)p++;
    if(p<k)
        cout<<"Ioana "<<k<<'\n';
    else if (p>k)cout<<"Maria "<<p<<'\n';
        else cout<<"Egalitate "<<k;
    return 0;
}

