#include <bits/stdc++.h>
using namespace std;
long long a[100005], b[100005];
pair<long long, long long> pos[100005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pos[i].first;
    pos[i].second = i;
  }
  sort(pos + 1, pos + 1 + n);
  for (int i = 1; i <= n / 3; i++) {
    a[pos[i].second] = i - 1;
    b[pos[i].second] = pos[i].first - (i - 1);
  }
  for (int i = (n / 3 + 1); i <= (2 * n / 3); i++) {
    b[pos[i].second] = (i - 1);
    a[pos[i].second] = pos[i].first - (i - 1);
  }
  for (int i = (2 * n / 3 + 1); i <= n; i++) {
    b[pos[i].second] = n - i;
    a[pos[i].second] = pos[i].first - (n - i);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n - 1; i++) cout << a[i] << " ";
  cout << a[n] << endl;
  for (int i = 1; i <= n - 1; i++) cout << b[i] << " ";
  cout << b[n];
  return 0;
}
