#include <bits/stdc++.h>
using namespace std;
const char out[] = "FMS";
char s[3][32];
bool win(const int a, const int b) {
  return s[a][0] == 'r' && s[b][0] == 's' || s[a][0] == 's' && s[b][0] == 'p' ||
         s[a][0] == 'p' && s[b][0] == 'r';
}
int main() {
  int i, j, k;
  for (i = 0; i < 3; ++i) scanf("%s", s[i]);
  for (i = 0; i < 3; ++i) {
    if (win(i, (i + 2) % 3) && win(i, (i + 1) % 3)) {
      printf("%c\n", out[i]);
      return 0;
    }
  }
  puts("?");
  return 0;
}
