#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int START = 0;
const int FINISH = 1;
bool g[MAXN][MAXN];
int n, paths;
void add_edge(int a, int b) { g[a][b] = g[b][a] = true; }
void add_pow2(int k, int len) {
  if (k == len) {
    for (int i = 0; i < k; ++i) {
      if (i == 0) {
        add_edge(n++, START);
        add_edge(n++, START);
      } else {
        add_edge(n, n - 1);
        add_edge(n, n - 2);
        add_edge(n + 1, n - 1);
        add_edge(n + 1, n - 2);
        n += 2;
      }
      if (i == k - 1) {
        add_edge(n - 1, FINISH);
        add_edge(n - 2, FINISH);
      }
    }
  }
  if (k < len) {
    if (k == 0) {
      add_edge(n++, START);
    } else {
      add_edge(2 * k, n);
      add_edge(2 * k + 1, n);
      n++;
    }
    for (int i = k + 1; i < len; ++i) {
      add_edge(n, n - 1);
      n++;
    }
    add_edge(n - 1, FINISH);
  }
}
int main() {
  cin >> paths;
  if (paths == 1) {
    cout << "2\nNY\nYN\n";
    return 0;
  }
  n = 2;
  int len = -1;
  for (int k = 30; k >= 0; --k) {
    if (paths & (1 << k)) {
      if (len == -1) len = k;
      add_pow2(k, len);
    }
  }
  cout << n << endl;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if (g[i][j])
        cout << "Y";
      else
        cout << "N";
    cout << endl;
  }
  return 0;
}
