#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, X[100005], Y[100005], a;
  vector<pair<int, int> > A;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    A.push_back(make_pair(a, i));
  }
  int factor;
  if (n % 3 == 0)
    factor = n / 3;
  else
    factor = (n / 3) + 1;
  sort(A.begin(), A.end());
  for (int i = 0; i < factor; i++) {
    X[A[i].second] = i;
    Y[A[i].second] = A[i].first - i;
  }
  for (int i = factor; i < 2 * factor && i < n; i++) {
    Y[A[i].second] = i;
    X[A[i].second] = A[i].first - i;
  }
  for (int i = 2 * factor; i < n; i++) {
    Y[A[i].second] = n - 1 - i;
    X[A[i].second] = A[i].first - Y[A[i].second];
  }
  cout << "YES" << endl;
  for (int i = 0; i <= n - 1; i++) cout << X[i] << " ";
  ;
  cout << endl;
  for (int i = 0; i <= n - 1; i++) cout << Y[i] << " ";
  ;
  cout << endl;
  return 0;
}
