#include <bits/stdc++.h>
using std::min;
using std::sort;
int const N = 111111;
struct node {
  int num, id;
  bool operator<(const node& tmp) const { return num < tmp.num; }
} Data[N];
int n, a[N], b[N];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%d", &Data[i].num), Data[i].id = i;
    sort(Data, Data + n);
    int k = (n + 2) / 3, up1, up2, up3;
    up1 = min(k, n);
    for (int i = 0; i < up1; i++) {
      a[Data[i].id] = Data[i].num;
      b[Data[i].id] = 0;
    }
    up2 = min(2 * k, n);
    for (int i = up1; i < up2; i++) {
      a[Data[i].id] = 0;
      b[Data[i].id] = Data[i].num;
    }
    up3 = min(3 * k, n);
    for (int i = up2; i < up3; i++) {
      b[Data[i].id] = k--;
      a[Data[i].id] = Data[i].num - b[Data[i].id];
    }
    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]);
    printf("\n");
  }
  return 0;
}
