#include<bits/stdc++.h>
using namespace std;
int main(){
  string g;
  int y,m,d;
  while(1){
    cin>>g>>y>>m>>d;
    if(g == "#") break;
    if(y>31 || (y==31 && m>=5)){
      cout<<"? "<<y-31+1<<" "<<m<<" "<<d<<endl;
    }
    else cout<<g<<" "<<y<<" "<<m<<" "<<d<<endl;
  }
  return 0;
}
