#include <bits/stdc++.h>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
vector<int> v, v1;
pair<int, int> p[100004];
int a[100004], b[100004];
int main() {
  int n, i, j;
  cin >> n;
  for (j = 0; j < n; j++) {
    cin >> p[j].first;
    p[j].second = j;
  }
  sort(p, p + n);
  long long z = 0;
  int need = n - (n + 2) / 3;
  for (j = n - need; j < n; j++) {
    if (z % 2 == 0) {
      a[p[j].second] = p[j].first - z / 2;
      b[p[j].second] = z / 2;
    } else {
      a[p[j].second] = z / 2;
      b[p[j].second] = p[j].first - z / 2;
    }
    z++;
  }
  for (j = 0; j < n - need; j++) {
    a[p[j].second] = 0;
    b[p[j].second] = p[j].first;
  }
  cout << "YES" << endl;
  for (j = 0; j < n; j++) cout << a[j] << " ";
  cout << endl;
  for (j = 0; j < n; j++) cout << b[j] << " ";
  return 0;
}
