#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
const int maxn = (int)1e5;
pair<int, int> s[maxn];
int s0[maxn], ans[2][maxn];
int main() {
  srand(rdtsc());
  int n;
  while (scanf("%d", &n) >= 1) {
    for (int i = 0; i < n; i++)
      scanf("%d", &s[i].first), s[i].second = i, s0[i] = s[i].first;
    sort(s, s + n);
    int m = (n + 2) / 3;
    for (int iter = 0; iter < 3; iter++) {
      int tmp = n - iter * m;
      for (int i = iter * m; i < (iter + 1) * m && i < n; i++) {
        int v1 = !iter       ? 0
                 : iter == 1 ? s[i].first
                             : tmp--,
            v2 = s[i].first - v1;
        ans[0][s[i].second] = v1;
        ans[1][s[i].second] = v2;
      }
    }
    printf("YES\n");
    for (int iter = 0; iter < 2; iter++) {
      for (int i = 0; i < n; i++) {
        assert(ans[iter][i] + ans[!iter][i] == s0[i]);
        printf("%d%c", ans[iter][i], " \n"[i == n - 1]);
      }
    }
    for (int iter = 0; iter < 2; iter++) {
      sort(ans[iter], ans[iter] + n);
      int m = unique(ans[iter], ans[iter] + n) - ans[iter];
      assert(m >= (n * 2) / 3);
    }
  }
  return 0;
}
