#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  n--;
  vector<int> val1(n);
  vector<int> val2(n);
  for (int i = 0; i < n; i++) cin >> val1[i];
  for (int i = 0; i < n; i++) cin >> val2[i];
  vector<int> ans(n + 1);
  bool same = false;
  ans[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (val2[i - 1] % 2 == 1) {
      if (ans[i - 1] == 0 && same == false) {
        for (int j = 0; j < i; j++) {
          int ost = ans[j] % 2;
          ans[j] = ans[j] - ost + (ost + 1) % 2;
        }
      }
      if (ans[i - 1] == 0 && same == true) {
        cout << "NO";
        return 0;
      }
      ans[i] += 1;
      same = true;
    } else if (val1[i - 1] % 2 == 0) {
      if (ans[i - 1] == 1 && same == false) {
        for (int j = 0; j < i; j++) {
          int ost = ans[j] % 2;
          ans[j] = ans[j] - ost + (ost + 1) % 2;
        }
      }
      if (ans[i - 1] == 1 && same == true) {
        cout << "NO";
        return 0;
      }
      same = true;
    } else {
      ans[i] += (ans[i - 1] % 2 + 1) % 2;
    }
  }
  same = false;
  for (int i = 1; i <= n; i++) {
    if ((val2[i - 1] / 2) % 2 == 1) {
      if (ans[i - 1] / 2 == 0 && same == false) {
        for (int j = 0; j < i; j++) {
          int ost = (ans[j] / 2) % 2;
          ans[j] = ans[j] - 2 * ost + 2 * ((ost + 1) % 2);
        }
      }
      if (ans[i - 1] / 2 == 0 && same == true) {
        cout << "NO";
        return 0;
      }
      ans[i] += 2;
      same = true;
    } else if ((val1[i - 1] / 2) % 2 == 0) {
      if (ans[i - 1] / 2 == 1 && same == false) {
        for (int j = 0; j < i; j++) {
          int ost = (ans[j] / 2) % 2;
          ans[j] = ans[j] - 2 * ost + 2 * ((ost + 1) % 2);
        }
      }
      if (ans[i - 1] / 2 == 1 && same == true) {
        cout << "NO";
        return 0;
      }
      same = true;
    } else {
      ans[i] += 2 * (((ans[i - 1] / 2) % 2 + 1) % 2);
    }
  }
  for (int i = 1; i < n + 1; i++) {
    if ((ans[i] | ans[i - 1]) != val1[i - 1]) {
      cout << "NO";
      return 0;
    }
    if ((ans[i] & ans[i - 1]) != val2[i - 1]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n + 1; i++) {
    cout << ans[i] << " ";
  }
  cin >> n;
  return 0;
}
