#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 * 1000 + 321;
int a[maxN], b[maxN];
pair<int, int> in[maxN];
int ans1[maxN];
int ans2[maxN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in[i].first;
    in[i].second = i;
  }
  if (n == 1) {
    cout << "YES" << endl;
    cout << in[0].first << endl << 0 << endl;
    return 0;
  }
  sort(in, in + n);
  for (int i = 0; i < n / 3; i++) a[i] = i;
  for (int i = n / 3; i < 2 * n / 3; i++) b[i] = i;
  int count = 1;
  for (int i = n - 1; i >= 2 * n / 3; i--) {
    b[i] = count;
    a[i] = i - b[i];
    count++;
  }
  for (int i = 0; i < n; i++) {
    int u = in[i].second;
    int diff = in[i].first - i;
    ans1[u] = a[i] + diff;
    ans2[u] = b[i];
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ans1[i] << ' ';
  cout << endl;
  for (int i = 0; i < n; i++) cout << ans2[i] << ' ';
  cout << endl;
  return 0;
}
