#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const double PI = acos(-1.0);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  pair<long long, long long> p[n];
  for (long long i = 0; i < n; i++) {
    cin >> p[i].first;
    p[i].second = i;
  }
  sort(p, p + n);
  long long a[n], b[n];
  for (long long i = 0; i < (n + 2) / 3; i++) {
    a[p[i].second] = i;
    b[p[i].second] = p[i].first - i;
  }
  for (long long i = (n + 2) / 3; i < (2 * n + 2) / 3; i++) {
    b[p[i].second] = i;
    a[p[i].second] = p[i].first - i;
  }
  for (long long i = (2 * n + 2) / 3; i < n; i++) {
    b[p[i].second] = n - 1 - i;
    a[p[i].second] = p[i].first - (n - 1 - i);
  }
  cout << "YES\n";
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
  for (long long i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  cout << "\n";
}
