#include using namespace std; int main(){ int N; cin >> N; string S; cin >> S; bool ok = true; if (S[0] != 'Q'){ ok = false; } for (int i = 1; i < N; i++){ if (S[i] != 'H' && S[i] != 'Q' && S[i] != '9' && S[i] != '+'){ ok = false; } } if (ok){ cout << S << endl; } else { cout << -1 << endl; } }