#include <bits/stdc++.h>
struct str {
  int val, ind;
};
str arr[100000];
void qsort(int l, int r) {
  int x = l, y = r, m = arr[(l + r) / 2].val;
  while (x <= y) {
    while (arr[x].val < m) x++;
    while (arr[y].val > m) y--;
    if (x <= y) {
      str tmp = arr[x];
      arr[x] = arr[y];
      arr[y] = tmp;
      x++;
      y--;
    }
  }
  if (x < r) qsort(x, r);
  if (l < y) qsort(l, y);
}
int A[100000];
int B[100000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i].val);
    arr[i].ind = i;
  }
  if (n == 1) {
    printf("YES\n%d\n%d", 0, arr[0].val);
    return 0;
  }
  qsort(0, n - 1);
  for (int i = 0; i < (n + 1) / 3; i++) {
    A[arr[i].ind] = arr[i].val;
    B[arr[i].ind] = 0;
  }
  for (int i = (n + 1) / 3; i < (n + 1) / 3 * 2; i++) {
    A[arr[i].ind] = 0;
    B[arr[i].ind] = arr[i].val;
  }
  for (int i = (n + 1) / 3 * 2; i < n; i++) {
    B[arr[i].ind] = n - i;
    A[arr[i].ind] = arr[i].val - B[arr[i].ind];
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", A[i]);
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", B[i]);
  }
}
