#include <bits/stdc++.h>
using namespace std;

int main() {

  int N,ret,maxval,mval,mval2;
  cin>> N ;
  vector<int> A(N),B(N);
  mval=0;
  mval2=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  B(N)=A(N);
  sort(A.begin(), A.end() ,greater<int>());
  mval=A.at(0);
  mval2=A.at(1);

  for (int i=0;i<N;i++){
    maxval=mval;
    if(mval==B.at(i)){
      cout<<"Y";
      maxval=mval2;
  }
    cout<<maxval<<endl;
  }

}
