#include <bits/stdc++.h>
using namespace std;
int rec[1005][1005];
int main() {
  int x, p, k, i, j;
  cin >> k;
  if (k == 1) {
    printf("2\nNY\nYN\n");
    return 0;
  }
  p = log2(k - 1) + 1;
  int n = 3 * p + 2;
  for (x = 1, i = 1; i <= p + 1; i++, x += 3) {
    rec[x][x + 2] = rec[x + 2][x] = 1;
  }
  rec[1][4] = rec[4][1] = 1;
  for (i = 1, x = 3; i <= p; i++, x += 3) {
    rec[x][x + 4] = rec[x + 4][x] = 1;
  }
  rec[1][5] = rec[5][1] = 1;
  for (i = 1, x = 5; i <= p - 1; i++, x += 3) {
    rec[x][x + 3] = rec[x + 3][x] = 1;
  }
  rec[x][2] = rec[2][x] = 1;
  for (i = 3; i <= 3 * p; i++) rec[i][i + 3] = rec[i + 3][i] = 1;
  for (i = 0; i < p; i++) {
    if ((1LL << i) & (k - 1)) {
      int x = (i + 1) * 3 + 1, y = (i + 2) * 3 + 2;
      if (i == p - 1)
        rec[x][2] = rec[2][x] = 1;
      else
        rec[x][y] = rec[y][x] = 1;
    }
  }
  printf("%d\n", n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      printf(rec[i][j] ? "Y" : "N");
    }
    printf("\n");
  }
}
