#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T& v) {
  for (typename T::value_type& x : v) cin >> x;
}
template <class T>
void print(T& v) {
  for (typename T::value_type& x : v) cout << x << ' ';
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v(n), a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n; ++i) a[i].second = b[i].second = v[i].second;
  int k = (n + 2) / 3;
  int k2 = 2 * k;
  int cur = 0, i;
  for (i = 0; i < k && i < n; ++i) {
    a[i].first = i;
    b[i].first = v[i].first - i;
  }
  for (; i < k2 && i < n; ++i) {
    a[i].first = v[i].first - i;
    b[i].first = i;
  }
  for (--k; i < n; ++i) {
    b[i].first = k--;
    a[i].first = v[i].first - b[i].first;
  }
  for (pair<int, int>& p : a) swap(p.first, p.second);
  for (pair<int, int>& p : b) swap(p.first, p.second);
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  cout << "YES" << endl;
  for (pair<int, int>& p : a) cout << p.second << ' ';
  cout << endl;
  for (pair<int, int>& p : b) cout << p.second << ' ';
  cout << endl;
  return 0;
}
