#include <bits/stdc++.h>
#define INT long long int
#define N 3
#define PA pair<INT, INT>
#define oo 9876543219876543
#define MOD 1000000007
using namespace std;
INT T, n;
string s[100];
char in[100];
int main()
{
    int a, b, c, d, e, f, x, y;
    scanf("%d:%d:%d",&a, &b, &c);
    scanf("%d:%d:%d",&d, &e, &f);
    x = c + b*60 + a*60*60;
    y = f + e*60 + d*60*60;
    if( x < y ) cout<<"A";
    else if( x > y ) cout<<"B";
    else cout<<"A=B";
    return 0;
}
