#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int k;
  cin >> k;
  vector<int> count;
  while (k) {
    count.push_back(k % 10);
    k /= 10;
  }
  vector<vector<char> > board(1000, vector<char>(1000, 'N'));
  int node = 2;
  for (int i = 0; i < count.size(); ++i) {
    if (count[i] == 0) {
      continue;
    }
    vector<int> pre_layer(1, 0);
    for (int j = 0; j < i; ++j) {
      vector<int> cur_layer;
      for (int p = 0; p < 10; ++p) {
        for (int q = 0; q < pre_layer.size(); ++q) {
          board[pre_layer[q]][node] = 'Y';
          board[node][pre_layer[q]] = 'Y';
        }
        cur_layer.push_back(node++);
      }
      pre_layer = cur_layer;
    }
    for (int j = 0; j < count.size() - i - 1; ++j) {
      vector<int> cur_layer(1, node++);
      for (int p = 0; p < pre_layer.size(); ++p) {
        board[pre_layer[p]][node - 1] = 'Y';
        board[node - 1][pre_layer[p]] = 'Y';
      }
      pre_layer = cur_layer;
    }
    vector<int> cur_layer;
    for (int j = 0; j < count[i]; ++j) {
      for (int p = 0; p < pre_layer.size(); ++p) {
        board[pre_layer[p]][node] = 'Y';
        board[node][pre_layer[p]] = 'Y';
      }
      cur_layer.push_back(node++);
    }
    for (int j = 0; j < cur_layer.size(); ++j) {
      board[cur_layer[j]][1] = 'Y';
      board[1][cur_layer[j]] = 'Y';
    }
  }
  cout << node << endl;
  for (int i = 0; i < node; ++i) {
    for (int j = 0; j < node; ++j) {
      cout << board[i][j];
    }
    cout << endl;
  }
  return 0;
}
