#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = 2 * acos(0.0);
const string alphabetU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string alphabetL = "abcdefghijklmnopqrstuvwxyz";
const long long infinite = 1000000000;
const long long maxn = 100010;
static const int m37pos[] = {32, 0, 1,  26, 2,  23, 27, 0,  3,  16, 24, 30, 28,
                             11, 0, 13, 4,  7,  17, 0,  25, 22, 31, 15, 29, 10,
                             12, 6, 0,  21, 14, 9,  5,  20, 8,  19, 18};
inline int nextInt() {
  int x = 0;
  register int c = getc(stdin);
  int sign = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getc(stdin))
    ;
  if (c == '-') {
    sign = 1;
    c = getc(stdin);
  }
  for (; c > 47 && c < 58; c = getc(stdin)) x = (x << 1) + (x << 3) + c - 48;
  if (sign) x = -x;
  return x;
}
inline long long nextLong() {
  long long x = 0;
  register int c = getc(stdin);
  int sign = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getc(stdin))
    ;
  if (c == '-') {
    sign = 1;
    c = getc(stdin);
  }
  for (; c > 47 && c < 58; c = getc(stdin)) x = (x << 1) + (x << 3) + c - 48;
  if (sign) x = -x;
  return x;
}
inline string nextLine() {
  string s;
  while (!feof(stdin)) {
    char c = fgetc(stdin);
    if (c == 13) continue;
    if (c == 10) return s;
    s += c;
  }
  return s;
}
void scan(int &x) { x = nextInt(); }
void scanl(long long &x) { x = nextLong(); }
void scans(string &s) { s = nextLine(); }
struct pp {
  int v, p;
  bool operator<(const pp &x) const {
    if (v != x.v)
      return v < x.v;
    else
      return p < x.p;
  }
};
pp a[maxn];
int n, b[maxn], c[maxn];
void input() {
  scan(n);
  for (int i = 1, _b = n; i <= _b; i++) {
    scan(a[i].v);
    a[i].p = i;
  }
}
void process() {
  sort(&a[1], &a[n + 1]);
  int need = n / 3;
  for (int i = 1, _b = need; i <= _b; i++) {
    b[a[i].p] = 0;
    c[a[i].p] = a[i].v;
  }
  int z = 0;
  for (int i = need + 1, _b = n; i <= _b; i++) {
    if (z & 1) {
      b[a[i].p] = z / 2;
      c[a[i].p] = a[i].v - z / 2;
    } else {
      b[a[i].p] = a[i].v - z / 2;
      c[a[i].p] = z / 2;
    }
    z++;
  }
  cout << "YES" << endl;
  for (int i = 1, _b = n; i <= _b; i++) printf("%d ", b[i]);
  cout << endl;
  for (int i = 1, _b = n; i <= _b; i++) printf("%d ", c[i]);
}
int main() {
  int test = 1;
  for (int i = 1, _b = test; i <= _b; i++) {
    input();
    process();
  }
  return 0;
}
