#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double PI = acos(-1);
const double EPS = 1e-8;
const int N = 100010;
int in[N];
pair<int, int> p[N];
int A[N];
int B[N];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < (int)(n); ++i) {
      cin >> in[i];
      p[i] = pair<int, int>(in[i], i);
    }
    sort(p, p + n);
    for (int i = 0; i < (n + 2) / 3; ++i) {
      A[p[i].second] = 0;
    }
    int now = p[(n + 2) / 3].first;
    bool f = 0;
    map<int, int> mp1, mp2;
    for (int i = (n + 2) / 3; i < n; ++i) {
      int x = p[i].first;
      int pos = p[i].second;
      if (now < 0) {
        now = x - 1;
      }
      while (mp1.count(now) || mp2.count(x - now)) {
        now--;
      }
      A[pos] = now;
      mp1[now] = 1;
      mp2[x - now] = 1;
      now--;
    }
    cout << "YES" << endl;
    for (int i = 0; i < (int)(n); ++i) cout << A[i] << " ";
    cout << endl;
    for (int i = 0; i < (int)(n); ++i) cout << in[i] - A[i] << " ";
    cout << endl;
  }
}
