#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
pair<int, int> p[N];
int b[N], a[N], n;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    cin >> p[i].first;
    p[i].second = i;
  }
  sort(p, p + n);
  for (int i = 0; i < ((n + 2) / 3); ++i) {
    a[p[i].second] = i;
    if (n > 1) b[p[i + (n + 2) / 3].second] = i + (n + 2) / 3;
    if (n > 1)
      a[p[i + (n + 2) / 3].second] = p[i + (n + 2) / 3].first - i - (n + 2) / 3;
    b[p[i].second] = p[i].first - i;
  }
  for (int i = (n + 2) / 3 * 2; i < n; ++i) {
    b[p[i].second] = n - i - 1;
    a[p[i].second] = p[i].first - b[p[i].second];
  }
  cout << "YES" << endl;
  for (int i = 0; i < (n); ++i) cout << a[i] << ' ';
  cout << endl;
  for (int i = 0; i < (n); ++i) cout << b[i] << ' ';
  return 0;
}
