#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    while(cin >> s, s != "#"){
        int y,m,d;
        cin >> y >> m >> d;
        if(y > 31 || (y == 31 && m > 4)){
            cout << "? " << y-30 << " " << m << " " << d << endl;
        }else{
            cout << s << " " << y << " " << m << " " << d << endl;
        }
    }
}

