#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const long long LINF = INF * 1ll * INF;
const double PI = acos(-1.0);
using namespace std;
pair<int, int> s[100001];
int a[100001], b[100001];
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  int p = (n + 2) / 3;
  for (int i = 0; i < n; i++) {
    if (i < p) {
      a[s[i].second] = i;
      b[s[i].second] = s[i].first - a[s[i].second];
    } else if (i < 2 * p) {
      b[s[i].second] = i;
      a[s[i].second] = s[i].first - b[s[i].second];
    } else {
      b[s[i].second] = n - 1 - i;
      a[s[i].second] = s[i].first - b[s[i].second];
    }
  }
  puts("YES");
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
}
