#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    vector<pair<int, int> > s(n);
    for (int i = 0; i < n; i++) scanf("%d", &s[i].first), s[i].second = i;
    sort((s).begin(), (s).end());
    int m1 = n / 3;
    int m2 = 2 * n / 3;
    vector<int> a(n), b(n);
    for (int i = 0; i < m1; i++) a[i] = i, b[i] = s[i].first - a[i];
    for (int i = m1; i < m2; i++) b[i] = i, a[i] = s[i].first - b[i];
    for (int i = m2; i < n; i++) b[i] = n - 1 - i, a[i] = s[i].first - b[i];
    vector<int> ansa(n), ansb(n);
    bool ok = 1;
    for (int i = 0; i < n; i++) {
      if (a[i] < 0 || b[i] < 0) ok = 0;
      ansa[s[i].second] = a[i], ansb[s[i].second] = b[i];
    }
    if (!ok)
      puts("NO");
    else {
      puts("YES");
      for (int i = 0; i < n; i++) printf("%d%c", ansa[i], " \n"[i == n - 1]);
      for (int i = 0; i < n; i++) printf("%d%c", ansb[i], " \n"[i == n - 1]);
    }
  }
  return 0;
}
