#include <bits/stdc++.h>
using namespace std;
int usedV;
int lastV;
int lastVDist;
int K;
char mp[1007][1007];
void rec(int waysHere, int connTo, int dist) {
  if (waysHere * 2 > K) {
    mp[connTo][2] = 'Y';
    K -= waysHere;
    lastV = connTo;
    lastVDist = dist;
    return;
  }
  int a = ++usedV;
  int b = ++usedV;
  int c = ++usedV;
  mp[connTo][a] = 'Y';
  mp[connTo][b] = 'Y';
  mp[a][c] = 'Y';
  mp[b][c] = 'Y';
  rec(waysHere * 2, c, dist + 2);
  if (waysHere <= K) {
    int last = connTo;
    for (int i = (0); i < (lastVDist - dist - 1); i++) {
      mp[last][++usedV] = 'Y';
      last = usedV;
    }
    mp[last][lastV] = 'Y';
    K -= waysHere;
  }
}
int main() {
  scanf("%d ", &K);
  ;
  for (int i = (0); i < (1007); i++)
    for (int j = (0); j < (1007); j++) mp[i][j] = 'N';
  mp[1][3] = 'Y';
  usedV = 3;
  rec(1, 3, 0);
  for (int i = (0); i < (1007); i++)
    for (int j = (0); j < (1007); j++) {
      if (mp[i][j] == 'Y' || mp[j][i] == 'Y') mp[i][j] = mp[j][i] = 'Y';
    }
  printf("%d\n", usedV);
  for (int i = (0); i < (usedV); i++) {
    for (int j = (0); j < (usedV); j++) {
      printf("%c", mp[i + 1][j + 1]);
    }
    printf("\n");
  }
  return 0;
}
