#include <bits/stdc++.h>
using namespace std;
const int TAM = 1e5 + 10;
struct Nodo {
  int id, s, a, b;
};
bool byS(const Nodo& x, const Nodo& y) { return x.s < y.s; }
bool byID(const Nodo& x, const Nodo& y) { return x.id < y.id; }
int n;
Nodo nodo[TAM];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> nodo[i].s;
    nodo[i].id = i;
  }
  sort(nodo, nodo + n, byS);
  for (int i = 0; i < (n + 2) / 3; i++) {
    nodo[i].a = i;
    nodo[i].b = nodo[i].s - nodo[i].a;
  }
  for (int i = (n + 2) / 3; i < n - n / 3; i++) {
    nodo[i].b = i;
    nodo[i].a = nodo[i].s - nodo[i].b;
  }
  for (int i = n - n / 3; i < n; i++) {
    nodo[i].b = n - 1 - i;
    nodo[i].a = nodo[i].s - nodo[i].b;
  }
  sort(nodo, nodo + n, byID);
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << nodo[i].a << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << nodo[i].b << " ";
  cout << endl;
  return 0;
}
