#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007, dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
const double eps = 1e-8;
void read(int &k) {
  k = 0;
  char x = getchar();
  while (x < '0' || x > '9') x = getchar();
  while (x >= '0' && x <= '9') {
    k = k * 10 - 48 + x;
    x = getchar();
  }
}
int b[100010], c[100010], d[100010], e[100010], n, m, ad, ta, Tm;
pair<int, int> a[100010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i;
  sort(a, a + n);
  int oo = n;
  while (n % 3) a[n + 1] = a[n], n++;
  m = n / 3 * 2 - 1;
  Tm = n / 3 - 1;
  for (int i = n - 1; i > Tm; i--) {
    if ((i & 1) == ((n - 1) & 1)) {
      b[i] = a[i].first - (i - m);
      c[i] = i - m;
    } else {
      c[i] = a[i].first - (i - m);
      b[i] = i - m;
      m--;
    }
  }
  for (int i = Tm; i >= 0; i--) b[i] = a[i].first, c[i] = 0;
  for (int i = 0; i < oo; i++) {
    d[a[i].second] = b[i];
    e[a[i].second] = c[i];
  }
  puts("YES");
  for (int i = 0; i < oo; i++) printf("%d ", d[i]);
  puts("");
  for (int i = 0; i < oo; i++) printf("%d ", e[i]);
  puts("");
  return 0;
}
