#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  for (auto& vi : vec) os << vi << " ";
  return os;
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> ps(n);
  for (int i = 0; i < n; i++) cin >> ps[i].first, ps[i].second = i;
  sort(begin(ps), end(ps));
  cout << "YES" << endl;
  vector<int> a(n), b(n);
  int x = (n + 2) / 3;
  for (int i = 0; i < n; i++) {
    int s = ps[i].first, id = ps[i].second;
    if (i < x)
      a[id] = 0, b[id] = s;
    else if (i < x + x)
      a[id] = s, b[id] = 0;
    else
      a[id] = n - 1 - i, b[id] = s - a[id];
  }
  cout << a << endl << b << endl;
  return 0;
}
