#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

int a, b, c;
string str;

void solve() {
    cin >> a >> b >> c;
    if (a <= 30) {
        cout << str << " " << a << " " << b << " " << c << endl;
    } else if (a > 31) {
        cout << "? " << a-30 << " " << b << " " << c << endl;
    } else {
        if (b <= 4) {
            cout << str << " " << a << " " << b << " " << c << endl;
        } else {
            cout << "? " << a-30 << " " << b << " " << c << endl;
        }
    }
}

int main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
    cout.precision(20);
    cerr << fixed;
    cerr.precision(6);
#ifdef LOCAL
    //freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif  
    while (cin >> str) {
        if (str == "#") break;
        solve();
    }
    //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}

