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