#include <bits/stdc++.h>
using namespace std;
const long long sz = 1e5 + 10;
struct info {
  long long s, id;
} ara[sz];
const bool operator<(const info &a, const info &b) { return a.s < b.s; }
long long a[sz], b[sz];
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &ara[i].s), ara[i].id = i;
  sort(ara + 1, ara + n + 1);
  long long lim = n / 3;
  if (n % 3 != 0) lim++;
  for (long long i = 1; i <= lim; ++i) {
    a[ara[i].id] = ara[i].s;
    b[ara[i].id] = 0;
  }
  for (long long i = lim + 1; i <= 2 * lim; i++) {
    a[ara[i].id] = 0;
    b[ara[i].id] = ara[i].s;
  }
  for (long long i = 2 * lim + 1, k = lim; i <= n; i++, k--) {
    a[ara[i].id] = ara[i].s - k;
    b[ara[i].id] = k;
  }
  cout << "YES" << '\n';
  for (long long i = 1; i <= n; ++i) printf("%lld ", a[i]);
  printf("\n");
  for (long long i = 1; i <= n; ++i) printf("%lld ", b[i]);
  printf("\n");
  return 0;
}
