#include <bits/stdc++.h>
using namespace std;
int bmwp[100];
int pow2[100];
vector<int> ans;
vector<int>::iterator it;
map<int, int> my_hash;
int shortest;
int id;
const int S = 1;
const int T = 2;
bool grid[1008][1008];
void make_line(int dot, int type) {
  vector<pair<int, int> > me;
  vector<pair<int, int> >::iterator it;
  me.clear();
  for (int i = 1; i <= dot; i++) {
    me.push_back(make_pair(id, id + 1));
    id += 2;
  }
  if (type == 1 && dot != shortest) {
    my_hash.clear();
    for (int i = dot + 1; i <= shortest; i++) {
      me.push_back(make_pair(id, id));
      my_hash[i] = id;
      id += 1;
    }
  }
  it = me.begin();
  grid[S][it->first] = grid[S][it->second] = 1;
  grid[it->first][S] = grid[it->second][S] = 1;
  if (type == 1 && dot != shortest) {
    it = me.end() - 1;
    grid[it->first][T] = grid[it->second][T] = 1;
    grid[T][it->first] = grid[T][it->second] = 1;
  } else {
    it = me.end() - 1;
    int v = (dot == shortest ? T : my_hash[dot + 1]);
    grid[it->first][v] = grid[it->second][v] = 1;
    grid[v][it->first] = grid[v][it->second] = 1;
  }
  for (int i = 1; i < me.size(); i++) {
    int u1 = me[i - 1].first;
    int u2 = me[i - 1].second;
    int v1 = me[i].first;
    int v2 = me[i].second;
    grid[u1][v1] = grid[u1][v2] = 1;
    grid[u2][v1] = grid[u2][v2] = 1;
    grid[v1][u1] = grid[v1][u2] = 1;
    grid[v2][u1] = grid[v2][u2] = 1;
  }
}
void output() {
  int n = id - 1, i, j;
  cout << n << endl;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) printf("%s", grid[i][j] ? "Y" : "N");
    puts("");
  }
}
int main() {
  int i, k, sum = 0;
  pow2[0] = 1;
  for (i = 1; i <= 30; i++) pow2[i] = pow2[i - 1] * 2;
  cin >> k;
  if (k == 1) {
    puts("2");
    puts("NY");
    puts("YN");
    return 0;
  }
  ans.clear();
  for (i = 30; i >= 0; i--) {
    if (k >= pow2[i]) {
      ans.push_back(i);
      k -= pow2[i];
    }
  }
  memset(grid, 0, sizeof(grid));
  shortest = *ans.begin();
  id = 3;
  make_line(ans[ans.size() - 1], 1);
  for (i = ans.size() - 2; i >= 0; i--) make_line(ans[i], 0);
  output();
  return 0;
}
