#include <bits/stdc++.h>
const int maxm = 1e6 + 100;
struct node {
  int val, id;
};
node a[maxm];
bool comp(node x, node y) { return x.val < y.val; }
bool compid(node x, node y) { return x.id < y.id; }
int n;
node b[maxm], c[maxm];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].val), a[i].id = i;
  std::sort(a + 1, a + n + 1, comp);
  double x = (double)n / 3.0;
  int T = (int)ceil(x);
  for (int i = 1; i <= T; i++) {
    b[i].id = c[i].id = a[i].id;
    b[i].val = i - 1, c[i].val = a[i].val - b[i].val;
  }
  for (int i = T + 1; i <= n - T; i++) {
    b[i].id = c[i].id = a[i].id;
    c[i].val = i - 1, b[i].val = a[i].val - c[i].val;
  }
  for (int i = n - T + 1; i <= n; i++) {
    b[i].id = c[i].id = a[i].id;
    c[i].val = n - i, b[i].val = a[i].val - c[i].val;
  }
  std::sort(b + 1, b + n + 1, compid);
  std::sort(c + 1, c + n + 1, compid);
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d ", b[i].val);
  puts("");
  for (int i = 1; i <= n; i++) printf("%d ", c[i].val);
  return 0;
}
