#include <bits/stdc++.h>
using namespace std;
const long long N = 1005;
bool g[N][N];
void add(long long u, long long v) {
  g[u][v] = 1;
  g[v][u] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k, cur = 3;
  cin >> k;
  bool nav = 1;
  long long mx = 2;
  vector<pair<long long, long long> > st;
  for (long long i = 30; i >= 0; i--) {
    if ((1ll << i) & k) {
      if (nav) {
        for (long long t = i - 1, atsk = 2; t >= 0; t--, atsk += 2)
          add(mx, mx + 1), add(mx, mx + 2), add(mx + 1, mx + 3),
              add(mx + 2, mx + 3), mx += 3, st.push_back({mx, atsk});
        add(1, mx);
        cur = mx + 1;
        reverse(st.begin(), st.end());
        nav = 0;
      } else {
        auto t = st[i];
        add(2, cur);
        for (long long j = 2; j < t.second; j++) add(cur, cur + 1), cur++;
        add(t.first, cur++);
      }
    }
  }
  cout << cur - 1 << "\n";
  for (long long i = 1; i < cur; i++) {
    for (long long j = 1; j < cur; j++) cout << ((g[i][j]) ? 'Y' : 'N');
    cout << "\n";
  }
  return 0;
}
