#include<iostream>
using namespace std;

int main(){
    string g;
    int y,m,d;
    int ans;

    while(1){
        cin>>g>>y>>m>>d;
        if(g=="#")break;

        if(y>=32||(y==31&&m>=5))cout<<"? "<<y-30<<" "<<m<<" "<<d<<endl;
        else cout<<g<<" "<<y<<" "<<m<<" "<<d<<endl;
    }

    return 0;
}

