#include <bits/stdc++.h>
using namespace std;
struct node {
  int val, ix;
} s[105000];
int a[105000], b[105000], link[105000];
map<int, int> mata, matb;
int n, limit;
bool Judge() {
  mata.clear();
  matb.clear();
  int cnta = 0, cntb = 0;
  for (int i = 0; i < n; i++) {
    if (mata[a[i]] == 0) {
      mata[a[i]] = 1;
      cnta++;
    }
    if (matb[b[i]] == 0) {
      matb[b[i]] = 1;
      cntb++;
    }
  }
  if (cnta < limit || cntb < limit) return false;
  return true;
}
void Print() {
  puts("YES");
  for (int i = 0; i < n; i++) {
    if (i != 0) printf(" ");
    printf("%d", a[link[i]]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    if (i != 0) printf(" ");
    printf("%d", b[link[i]]);
  }
  printf("\n");
}
bool cmp(node x, node y) { return x.val < y.val; }
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &s[i].val);
    s[i].ix = i;
  }
  limit = n - (n / 3);
  if (n % 3 != 0) limit--;
  sort(s, s + n, cmp);
  for (i = 0; i < n; i++) {
    link[s[i].ix] = i;
  }
  for (i = 0; i < n / 3; i++) {
    a[i] = i;
    b[i] = s[i].val - i;
  }
  for (; i < n * 2 / 3; i++) {
    b[i] = i;
    a[i] = s[i].val - i;
  }
  for (i = n * 2 / 3; i < n; i++) {
    b[i] = n - 1 - i;
    a[i] = s[i].val - b[i];
  }
  Print();
  return 0;
}
