#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string s, str;
int main() {
cin >> n >> m >> k;
cin.ignore();
getline(cin, s);
int index = 0;
if ( !s.empty()) {
while ( (index = s.find(' ', index)) != string::npos) {
s.erase(index, 1);
}
}
getline(cin, str);
index = 0;
if ( !str.empty()) {
while ( (index = str.find(' ', index)) != string::npos) {
str.erase(index, 1);
}
}
if (n > m) {
cout << "Y";
} else if (n < m) {
cout << "X";
} else {
if (s > str) {
cout << "Y";
} else if (s == str) {
cout << "Same";
} else {
cout << "X";
}
}
return 0;
}