#include <bits/stdc++.h>
using namespace std;
struct st {
  int x, nom;
};
bool cmp1(st a1, st a2) { return a1.x < a2.x; }
bool cmp2(st a1, st a2) { return a1.nom < a2.nom; }
int main() {
  int n;
  cin >> n;
  vector<st> c(n), a = c, b = c;
  for (int i = 0; i < n; i++) {
    cin >> c[i].x;
    c[i].nom = i;
  }
  sort(c.begin(), c.end(), cmp1);
  for (int i = 0; i < n / 3; i++) {
    a[i].x = i;
    b[i].x = c[i].x - i;
    a[i].nom = b[i].nom = c[i].nom;
  }
  for (int i = n / 3; i < 2 * n / 3; i++) {
    b[i].x = i;
    a[i].x = c[i].x - i;
    a[i].nom = b[i].nom = c[i].nom;
  }
  for (int i = 2 * n / 3; i < n; i++) {
    b[i].x = n - 1 - i;
    a[i].x = c[i].x - b[i].x;
    a[i].nom = b[i].nom = c[i].nom;
  }
  sort(a.begin(), a.end(), cmp2);
  sort(b.begin(), b.end(), cmp2);
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << a[i].x << ' ';
  cout << endl;
  for (int i = 0; i < n; i++) cout << b[i].x << ' ';
  return 0;
}
