#include <bits/stdc++.h>
using namespace std;
int A[1 << 20];
int B[1 << 20];
int main() {
  int n;
  scanf("%d", &n);
  int i;
  vector<pair<int, int> > v;
  for (i = (0); i < (n); ++i) {
    int a;
    scanf("%d", &a);
    v.push_back(pair<int, int>(a, i));
  }
  sort((v).begin(), (v).end());
  int k = (n + 2) / 3;
  for (i = (0); i < (k); ++i) {
    int value = v[i].first;
    int pos = v[i].second;
    A[pos] = value;
    B[pos] = 0;
  }
  for (i = (k); i < (k + k); ++i)
    if (i < n) {
      int value = v[i].first;
      int pos = v[i].second;
      A[pos] = 0;
      B[pos] = value;
    }
  for (i = (k + k); i < (n); ++i) {
    int value = v[i].first;
    int pos = v[i].second;
    int t = n - 1 - i;
    A[pos] = value - t;
    B[pos] = t;
  }
  printf("YES\n");
  for (i = (0); i < (n); ++i) printf("%d%c", A[i], i == n - 1 ? '\n' : ' ');
  for (i = (0); i < (n); ++i) printf("%d%c", B[i], i == n - 1 ? '\n' : ' ');
  return 0;
};
