#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
int n;
struct Node {
  int val, a, b;
  int id;
};
Node p[N];
bool cmp(const Node &x, const Node &y) { return x.val < y.val; }
bool cmp1(const Node &x, const Node &y) { return x.id < y.id; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i].val);
    p[i].id = i;
  }
  sort(p + 1, p + n + 1, cmp);
  int lim = n / 3;
  if (n % 3) lim++;
  for (int i = 1; i <= lim; i++) {
    p[i].a = 0;
    p[i].b = p[i].val;
  }
  for (int i = n; i > n - lim; i--) {
    p[i].a = n - i;
    p[i].b = p[i].val - p[i].a;
  }
  for (int i = lim + 1; i <= n - lim; i++) {
    p[i].a = p[i].val;
    p[i].b = 0;
  }
  sort(p + 1, p + n + 1, cmp1);
  printf("YES\n");
  sort(p + 1, p + n + 1, cmp1);
  for (int i = 1; i <= n; i++) printf("%d%c", p[i].a, " \n"[i == n]);
  for (int i = 1; i <= n; i++) printf("%d%c", p[i].b, " \n"[i == n]);
  return 0;
}
