#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6 + 3;
const int INFI = 1e9 * 2;
const long long LINFI = 1e17;
const double pi = acos(-1.0);
const int N = 22;
const int M = 222222;
const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};
char a[3][N], d[5] = "FMS?";
bool win(char x, char y) {
  if (x == 's' && y == 'p') return 1;
  if (x == 'p' && y == 'r') return 1;
  if (x == 'r' && y == 's') return 1;
  return 0;
}
int solve() {
  if (win(a[0][0], a[1][0]) && win(a[0][0], a[2][0])) return 0;
  if (win(a[1][0], a[0][0]) && win(a[1][0], a[2][0])) return 1;
  if (win(a[2][0], a[0][0]) && win(a[2][0], a[1][0])) return 2;
  return 3;
}
int main() {
  while (cin >> a[0] >> a[1] >> a[2]) cout << d[solve()] << endl;
  return 0;
}
