#include <bits/stdc++.h>
using namespace std;
int n, a[100010], b[100010], aans[100010], bans[100010];
pair<int, int> arr[100010];
int main(void) {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  sort(arr, arr + n);
  for (int i = 0; i < n / 3; i++) {
    a[i] = i;
    b[i] = arr[i].first - a[i];
  }
  for (int i = n / 3; i < 2 * n / 3; i++) {
    b[i] = i;
    a[i] = arr[i].first - b[i];
  }
  for (int i = 2 * n / 3; i < n; i++) {
    b[i] = n - i - 1;
    a[i] = arr[i].first - b[i];
  }
  for (int i = 0; i < n; i++) {
    aans[arr[i].second] = a[i];
    bans[arr[i].second] = b[i];
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << aans[i] << " ";
  cout << "\n";
  for (int i = 0; i < n; i++) cout << bans[i] << " ";
  cout << "\n";
  return 0;
}
