#include <bits/stdc++.h>
using namespace std;
int getPoint(string a) {
  if (a == "rock") {
    return 0;
  } else if (a == "paper") {
    return 1;
  } else {
    return 2;
  }
}
void runTest() {
  string u, m, s;
  cin >> u;
  cin >> m;
  cin >> s;
  int ui = getPoint(u);
  int mi = getPoint(m);
  int si = getPoint(s);
  int uw = 0;
  int mw = 0;
  int sw = 0;
  if (ui > mi) {
    if (ui - mi == 1) {
      uw++;
    } else {
      mw++;
    }
  } else if (mi > ui) {
    if (mi - ui == 1) {
      mw++;
    } else {
      uw++;
    }
  }
  if (ui > si) {
    if (ui - si == 1) {
      uw++;
    } else {
      sw++;
    }
  } else if (si > ui) {
    if (si - ui == 1) {
      sw++;
    } else {
      uw++;
    }
  }
  if (si > mi) {
    if (si - mi == 1) {
      sw++;
    } else {
      mw++;
    }
  } else if (mi > si) {
    if (mi - si == 1) {
      mw++;
    } else {
      sw++;
    }
  }
  int arr[3];
  arr[0] = uw;
  arr[1] = mw;
  arr[2] = sw;
  int maz;
  maz = arr[0];
  for (int i = 1; i < 3; i++) {
    if (arr[i] > maz) {
      maz = arr[i];
    }
  }
  int count1 = 0;
  int pos = -1;
  for (int i = 0; i < 3; i++) {
    if (arr[i] == maz) {
      pos = i;
      count1++;
    }
  }
  if (count1 > 1) {
    cout << "?" << endl;
  } else {
    if (pos == 0) {
      cout << "F" << endl;
    } else if (pos == 1) {
      cout << "M" << endl;
    } else if (pos == 2) {
      cout << "S" << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
int main() {
  int testNum = 1;
  for (int i = 0; i < testNum; i++) {
    runTest();
  }
  return 0;
}
