#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


void solve(){
    int y,m,d;
    cin>>y>>m>>d;
    vector<int> h={31,4,30};
    if(h<vector<int>{y,m,d}){
        cout<<"? "<<y-30<<" "<<m<<" "<<d<<endl;
    }
    else cout<<"HEISEI "<<y<<" "<<m<<" "<<d<<endl;
}
int main(){
    string s;
    while(cin>>s,s!="#")solve();
    return 0;
}
