#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int N, arr[MAXN], tid[MAXN], a[MAXN], b[MAXN];
int main() {
  scanf("%d", &N);
  for (int i = (0), iend = (N); i < iend; ++i) scanf("%d", &arr[i]);
  iota(tid, tid + N, 0);
  sort(tid, tid + N,
       [](const int& x, const int& y) { return arr[x] < arr[y]; });
  int cur = 0;
  for (int _i = ((N + 2) / 3), _iend = (N); _i < _iend; ++_i) {
    int i = tid[_i];
    if (cur & 1)
      a[i] = cur >> 1, b[i] = arr[i] - a[i];
    else
      b[i] = cur >> 1, a[i] = arr[i] - b[i];
    cur++;
  }
  for (int i = (0), iend = ((N + 2) / 3); i < iend; ++i)
    b[tid[i]] = arr[tid[i]];
  puts("YES");
  for (int i = (0), iend = (N); i < iend; ++i) printf("%d ", a[i]);
  puts("");
  for (int i = (0), iend = (N); i < iend; ++i) printf("%d ", b[i]);
  return 0;
}
