#include <bits/stdc++.h>
using namespace std;
int getw(int a, int b) {
  if ((a == 4 && b == 8) || (a == 5 && b == 4) || (a == 8 && b == 5)) {
    return a;
  } else {
    return 100;
  }
}
int getwinner(int f, int m, int s) {
  int w;
  if (m == s) {
    w = getw(f, m);
  } else if (f == s) {
    w = getw(m, f);
  } else if (f == m) {
    w = getw(s, f);
  } else {
    w = 100;
  }
  return w;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string f, m, s;
  cin >> f;
  cin >> m;
  cin >> s;
  int ff = f.length(), mm = m.length(), ss = s.length(), w;
  w = getwinner(ff, mm, ss);
  if (w == ff) {
    cout << "F";
  } else if (w == mm) {
    cout << "M";
  } else if (w == ss) {
    cout << "S";
  } else {
    cout << "?";
  }
  return 0;
}
