#include <bits/stdc++.h>
using namespace std;
int n = 1000, k;
bool a[1000][1000];
int s = 0, f = 1;
int cnt = 2;
void add(int x, int y) { a[x][y] = a[y][x] = true; }
void make(int k) {
  for (int(i) = (cnt); i < (cnt + k); ++(i)) add(s, i);
  for (int(ttt) = (0); ttt < (4); ++(ttt)) {
    for (int(i) = (cnt); i < (cnt + k); ++(i))
      for (int(j) = (cnt + k); j < (cnt + k + k); ++(j)) add(i, j);
    cnt += k;
  }
  for (int(i) = (cnt); i < (cnt + k); ++(i)) add(i, f);
  cnt += k;
}
void m2(int k) {
  for (int(i) = (cnt); i < (cnt + k); ++(i)) add(s, i);
  for (int(ttt) = (0); ttt < (2); ++(ttt)) {
    for (int(i) = (cnt); i < (cnt + k); ++(i))
      for (int(j) = (cnt + k); j < (cnt + k + k); ++(j)) add(i, j);
    cnt += k;
  }
  for (int(i) = (cnt); i < (cnt + k); ++(i)) add(i, cnt + k);
  add(cnt + k, cnt + k + 1);
  add(cnt + k + 1, f);
  cnt += k + 2;
}
int main() {
  cin >> k;
  while (k) {
    int r = (int)pow(k, 1.0 / 5);
    if (r > 1) {
      make(r);
      k -= r * r * r * r * r;
    } else {
      r = pow(k, 1.0 / 3);
      m2(r);
      k -= r * r * r;
    }
  }
  n = cnt;
  cout << n << "\n";
  for (int(i) = (0); i < (n); ++(i)) {
    for (int(j) = (0); j < (n); ++(j)) cout << (a[i][j] == true ? 'Y' : 'N');
    cout << "\n";
  }
  return 0;
}
