#include <bits/stdc++.h>
std::unordered_map<
    char, std::unordered_map<char, std::unordered_map<char, std::string>>>
    re;
int main() {
  re['p']['r']['r'] = "F";
  re['r']['p']['r'] = "M";
  re['r']['r']['p'] = "S";
  re['s']['p']['p'] = "F";
  re['p']['s']['p'] = "M";
  re['p']['p']['s'] = "S";
  re['r']['s']['s'] = "F";
  re['s']['r']['s'] = "M";
  re['s']['s']['r'] = "S";
  std::string f, m, s;
  std::cin >> f >> m >> s;
  std::string ans = re[f.front()][m.front()][s.front()];
  if (ans.empty()) ans = "?";
  std::cout << ans;
  ;
}
