#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adj(1000);
string MAT[1000];
void addEdge(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
int main() {
  int N;
  cin >> N;
  int S = 0, T = 1;
  int ID = 2;
  int L = 30;
  vector<vector<int> > V(L);
  for (int i = 0; i < L; ++i) {
    V[i].push_back(ID++);
    V[i].push_back(ID++);
  }
  for (int i = 0; i + 1 < L; ++i) {
    addEdge(V[i][0], V[i + 1][0]);
    addEdge(V[i][0], V[i + 1][1]);
    addEdge(V[i][1], V[i + 1][0]);
    addEdge(V[i][1], V[i + 1][1]);
  }
  addEdge(V[L - 1][0], T);
  addEdge(V[L - 1][1], T);
  for (int i = 0; i < L; ++i) {
  }
  for (int i = 0; i <= L; ++i) {
    if ((1 << i) & N) {
      int C = L - i;
      int LI = ID++;
      addEdge(S, LI);
      for (int j = 0; j < C; ++j) {
        int nID = ID++;
        addEdge(LI, nID);
        LI = nID;
      }
      if (i == 0)
        addEdge(LI, T);
      else {
        addEdge(LI, V[C][0]);
        addEdge(LI, V[C][1]);
      }
    }
  }
  for (int i = 0; i < ID; ++i) {
    MAT[i] = string(ID, 'N');
  }
  cout << ID << endl;
  for (int i = 0; i < ID; ++i) {
    for (int j = 0; j < adj[i].size(); ++j) {
      MAT[i][adj[i][j]] = 'Y';
    }
    cout << MAT[i] << endl;
  }
}
