#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
const int N = 1e3 + 10;
const long long MOD = 1e9 + 7;
const int rx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int ry[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const long double eps = 1e-7;
const double pi = acos(-1.0);
const int INF = 2e9;
vector<int> g[N];
int rz[32];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int p = (31 - __builtin_clz(n));
  int z = p - 1;
  g[1].push_back(3);
  int nom = 3;
  for (int i = 0; i < p; i++) {
    if (nom == 3) {
      g[nom].push_back(nom + 1);
      g[nom].push_back(nom + 2);
      nom = 5;
      rz[z] = 4;
      z--;
    } else {
      g[nom - 1].push_back(nom + 1);
      g[nom - 1].push_back(nom + 2);
      g[nom].push_back(nom + 1);
      g[nom].push_back(nom + 2);
      nom += 2;
      rz[z] = nom - 1;
      z--;
    }
  }
  if (!p)
    g[nom].push_back(2);
  else {
    g[nom - 1].push_back(2);
    g[nom].push_back(2);
  }
  nom++;
  g[1].push_back(nom);
  for (int i = p - 1; i >= 0; i--) {
    if ((1 & (n >> i))) {
      g[nom].push_back(rz[i]);
    }
    g[nom].push_back(nom + 1);
    nom++;
  }
  cout << nom << endl;
  vector<vector<char> > pl(nom + 1, vector<char>(nom + 1, 'N'));
  for (int i = 1; i <= nom; i++) {
    for (auto it : g[i]) {
      pl[i][it] = 'Y';
      pl[it][i] = 'Y';
    }
  }
  for (int i = 1; i <= nom; i++) {
    for (int j = 1; j <= nom; j++) cout << pl[i][j];
    cout << endl;
  }
  return 0;
}
