#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e3 + 3;
int K;
int N, L;
char adj[MAXN][MAXN];
void join(int v, int u) { adj[v][u] = adj[u][v] = 'Y'; }
void mkpath(int v, int l, int u) {
  if (l == 1) {
    join(u, v);
  } else {
    join(v, N);
    N++;
    mkpath(N - 1, l - 1, u);
  }
}
int spn[MAXN], spl[MAXN];
int main() {
  scanf("%d", &K);
  memset(adj, 'N', sizeof(adj));
  N = 2;
  if (K == 1) {
    adj[0][1] = adj[1][0] = 'Y';
  } else {
    int maxb = 0;
    for (int i = 0; i < (int)31; i++)
      if (K & (1 << i)) maxb = i;
    L = 2 * maxb;
    int l = 0, v = 1, e = 0;
    spn[e] = v;
    spl[e] = l;
    while (l + 2 < L) {
      join(v, N);
      join(v, N + 1);
      join(N, N + 2);
      join(N + 1, N + 2);
      v = N + 2;
      N += 3;
      l += 2;
      e++;
      spn[e] = v;
      spl[e] = l;
    }
    join(v, N);
    join(v, N + 1);
    join(N, 0);
    join(N + 1, 0);
    N += 2;
    e++;
    spn[e] = v;
    spl[e] = l;
    for (int i = 0; i < (int)maxb; i++)
      if (K & (1 << i)) mkpath(0, L - spl[i], spn[i]);
  }
  for (int i = 0; i < (int)N; i++) {
  }
  printf("%d\n", N);
  for (int i = 0; i < (int)N; i++) {
    for (int j = 0; j < (int)N; j++) printf("%c", adj[i][j]);
    printf("\n");
  }
}
