#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
bool g[maxn][maxn];
inline void addedge(int u, int v) { g[u][v] = g[v][u] = 1; }
int main() {
  int n;
  scanf("%d", &n);
  n--;
  int tmp = n, lay = 0;
  while (tmp > 0) lay++, tmp /= 2;
  if (lay == 0) {
    puts("2\nNY\nYN");
    exit(0);
  }
  addedge(1, 3);
  addedge(1, 4);
  addedge(1, 5);
  addedge(lay * 3, 2);
  for (int i = 1; i < lay; i++) {
    addedge(i * 3, (i + 1) * 3);
    addedge(i * 3 + 1, (i + 1) * 3 + 1);
    addedge(i * 3 + 1, (i + 1) * 3 + 2);
    addedge(i * 3 + 2, (i + 1) * 3 + 2);
    addedge(i * 3 + 2, (i + 1) * 3 + 1);
  }
  int now = 0;
  while (n > 0) {
    now++;
    if (n & 1) {
      if (now == lay)
        addedge(2, 3 * now + 1);
      else
        addedge(3 * (now + 1), 3 * now + 1);
    }
    n >>= 1;
  }
  int ans = lay * 3 + 2;
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) {
    for (int j = 1; j <= ans; j++) {
      if (g[i][j])
        putchar('Y');
      else
        putchar('N');
    }
    puts("");
  }
  return 0;
}
