#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v1;
  string s;
  int arr[3] = {0};
  for (int i = 0; i < 3; ++i) {
    cin >> s;
    v1.push_back(s);
    if (v1[i].compare("rock") == 0) ++arr[0];
    if (v1[i].compare("paper") == 0) ++arr[1];
    if (v1[i].compare("scissors") == 0) ++arr[2];
  }
  bool yes = false;
  if (v1[0].compare("rock") == 0) {
    if (v1[1].compare("scissors") == 0 && v1[2].compare("scissors") == 0) {
      cout << "F" << endl;
      yes = true;
    }
  }
  if (v1[0].compare("paper") == 0) {
    if (v1[1].compare("rock") == 0 && v1[2].compare("rock") == 0) {
      cout << "F\n";
      yes = true;
    }
  }
  if (v1[0].compare("scissors") == 0) {
    if (v1[1].compare("paper") == 0 && v1[2].compare("paper") == 0) {
      cout << "F\n";
      yes = true;
    }
  }
  if (v1[1].compare("rock") == 0) {
    if (v1[0].compare("scissors") == 0 && v1[2].compare("scissors") == 0) {
      cout << "M" << endl;
      yes = true;
    }
  }
  if (v1[1].compare("paper") == 0) {
    if (v1[0].compare("rock") == 0 && v1[2].compare("rock") == 0) {
      cout << "M\n";
      yes = true;
    }
  }
  if (v1[1].compare("scissors") == 0) {
    if (v1[0].compare("paper") == 0 && v1[2].compare("paper") == 0) {
      cout << "M\n";
      yes = true;
    }
  }
  if (v1[2].compare("rock") == 0) {
    if (v1[1].compare("scissors") == 0 && v1[0].compare("scissors") == 0) {
      cout << "S" << endl;
      yes = true;
    }
  }
  if (v1[2].compare("paper") == 0) {
    if (v1[1].compare("rock") == 0 && v1[0].compare("rock") == 0) {
      cout << "S\n";
      yes = true;
    }
  }
  if (v1[2].compare("scissors") == 0) {
    if (v1[1].compare("paper") == 0 && v1[0].compare("paper") == 0) {
      cout << "S\n";
      yes = true;
    }
  }
  if (yes == false) cout << "?\n";
  return 0;
}
