#include <bits/stdc++.h>
using namespace std;
bool win(string a, string b) {
  if (a == "paper" && b == "rock" || a == "rock" && b == "scissors" ||
      a == "scissors" && b == "paper")
    return true;
  return false;
}
int main() {
  istream &is = cin;
  ostream &os = cout;
  string F, M, S;
  cin >> F >> M >> S;
  if (win(F, M) && win(F, S))
    cout << "F" << endl;
  else if (win(M, F) && win(M, S))
    cout << "M" << endl;
  else if (win(S, M) && win(S, F))
    cout << "S" << endl;
  else
    cout << "?" << endl;
  return 0;
}
