#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < n; ++j) {
      a[i][j] ^= s[j] == '1';
    }
  }
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < n; ++j) {
      a[i][j] ^= s[j] == '1';
    }
  }
  vector<int> b(n);
  string s;
  cin >> s;
  int pos = n;
  for (int i = 0; i < n; ++i) {
    b[i] = s[i] == '1';
    if (pos == n && b[i] == 1) {
      pos = i;
    }
  }
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[i][j] == 0) {
        continue;
      }
      if (pos == j) {
        ans.push_back(make_pair(0, i));
        for (int k = 0; k < n; ++k) {
          a[i][k] ^= b[k];
        }
      } else if (pos == i) {
        ans.push_back(make_pair(1, j));
        for (int k = 0; k < n; ++k) {
          a[k][j] ^= b[k];
        }
      } else {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << ans.size() << endl;
  for (auto it : ans) {
    if (it.first == 0)
      cout << "row ";
    else
      cout << "col ";
    cout << it.second << endl;
  }
  return 0;
}
