#include <bits/stdc++.h>
struct node {
  int s, posi;
} num[100010], a[100010], b[100010];
int n, x, i, len[2];
inline bool cmp(node a, node b) {
  if (a.s < b.s)
    return (1);
  else
    return (0);
}
inline bool cmp2(node a, node b) {
  if (a.posi < b.posi)
    return (1);
  else
    return (0);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &num[i].s);
    num[i].posi = i;
  }
  std::sort(&num[1], &num[n + 1], cmp);
  x = n / 3;
  len[0] = (int)ceil((n - x) / 2.0);
  len[1] = n - x - len[0];
  for (i = 1; i <= n; ++i) a[i].posi = b[i].posi = num[i].posi;
  for (i = 1; i <= len[0]; ++i) {
    a[i].s = 0;
    b[i].s = num[i].s;
  }
  for (i = len[0] + 1; i <= len[0] + len[1]; ++i) {
    a[i].s = num[i].s;
    b[i].s = 0;
  }
  for (i = len[0] + len[1] + 1; i <= n; ++i) {
    a[i].s = x;
    b[i].s = num[i].s - a[i].s;
    --x;
  }
  std::sort(&a[1], &a[n + 1], cmp2);
  std::sort(&b[1], &b[n + 1], cmp2);
  printf("YES\n");
  for (i = 1; i < n; ++i) printf("%d ", a[i].s);
  printf("%d\n", a[n].s);
  for (i = 1; i < n; ++i) printf("%d ", b[i].s);
  printf("%d\n", b[n].s);
  return 0;
}
