#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 9;
struct Data {
  int v;
  int id;
  Data() {}
  Data(int _id, int _v) : v(_v), id(_id) {}
  bool operator<(const Data &o) const { return v < o.v; }
} d[Maxn];
int a[Maxn], b[Maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &d[i].v);
    d[i].id = i;
  }
  sort(d + 1, d + 1 + n);
  puts("YES");
  int cnt = 0;
  int k = n / 3;
  if (n % 3 != 0) k++;
  int s;
  if (d[1].v == 0)
    s = 2, a[1] = b[1] = 0;
  else
    s = 1, k++;
  for (int i = s; i <= min(s + k - 1, n); ++i) {
    a[d[i].id] = 0;
    b[d[i].id] = d[i].v;
  }
  for (int i = s + k; i <= min(s + 2 * k - 1, n); ++i) {
    a[d[i].id] = d[i].v;
    b[d[i].id] = 0;
  }
  int beg = 0;
  for (int i = n; i >= s + 2 * k; --i) {
    a[d[i].id] = ++beg;
    b[d[i].id] = d[i].v - beg;
  }
  for (int i = 1; i <= n; ++i) {
    if (i > 1) putchar(' ');
    printf("%d", a[i]);
  }
  puts("");
  for (int i = 1; i <= n; ++i) {
    if (i > 1) putchar(' ');
    printf("%d", b[i]);
  }
  puts("");
  return 0;
}
