#include <bits/stdc++.h>
int k, cnt, i, t, last1, last2, now, j;
int f[1005][1005] = {0}, a[1005];
int main() {
  int k;
  scanf("%d", &k);
  while (k) {
    a[++cnt] = k % 2;
    k /= 2;
  }
  for (i = 1; i <= cnt / 2; i++) {
    t = a[i];
    a[i] = a[cnt - i + 1];
    a[cnt - i + 1] = t;
  }
  now = 3;
  f[1][3] = true;
  last1 = 3;
  last2 = 1;
  for (i = 2; i <= cnt; i++) {
    f[last1][++now] = true;
    f[last1][++now] = true;
    now++;
    last1 = now;
    f[now - 2][now] = true;
    f[now - 1][now] = true;
    f[last2][++now] = true;
    f[now][now + 1] = true;
    now++;
    if (a[i]) f[now - 2][now] = true;
    last2 = now;
  }
  f[last1][2] = true;
  printf("%d\n", now);
  for (i = 1; i <= now; i++) {
    for (j = 1; j <= now; j++) {
      if (f[i][j]) f[j][i] = true;
      if (f[j][i]) f[i][j] = true;
      if (f[i][j])
        printf("Y");
      else
        printf("N");
    }
    printf("\n");
  }
  return 0;
}
