#include <bits/stdc++.h>
using namespace std;
int vet[100001], tmp[100001], n, m, resa[100001], resb[100001], ma, mb, p;
map<int, int> a, b, pos;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &vet[i]), tmp[i] = vet[i];
  sort(vet, vet + n);
  for (int i = 0; i < n; ++i) pos[vet[i]] = i;
  m = (n + 2) / 3;
  ma = m, mb = m;
  p = 0;
  for (; p < n && ma; ++p) {
    if (a.count(0)) --ma;
    a[0]++;
    b[vet[p]]++;
    resa[p] = 0;
    resb[p] = vet[p];
  }
  for (; p < n && mb; ++p) {
    if (b.count(0)) --mb;
    b[0]++;
    a[vet[p]]++;
    resa[p] = vet[p];
    resb[p] = 0;
  }
  for (int i = p; i < n; ++i) {
    int la = n - i;
    resa[i] = la;
    resb[i] = vet[i] - la;
  }
  printf("YES\n");
  for (int i = 0; i < n; ++i) printf("%d ", resa[pos[tmp[i]]]);
  printf("\n");
  for (int i = 0; i < n; ++i) printf("%d ", resb[pos[tmp[i]]]);
  printf("\n");
}
