n = int(input()) S = input() if 'Hello, World!' in S or '99 bottles of beer on the wall, 99 bottles of beer.' in S: S = S.replace('Hello, World!', 'H') S = S.replace('99 bottles of beer on the wall, 99 bottles of beer.', '9') if set(S) == {'H'} or set(S) == {'9'} or set(S) == {'H', '9'} or set(S) == {'9', 'H'}: print(S) else: print(-1) elif 'H' not in S and '9' not in S and 'Q' in S: print(S) else: print(-1)