#include <bits/stdc++.h>
using namespace std;
const int maxl = 1000 * 100 + 5;
int a[maxl], arr[maxl], ans[maxl];
int n;
bool cmp(const int &i, const int &j) { return a[i] < a[j]; }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    arr[i] = i;
  }
  sort(arr, arr + n, cmp);
  for (int i = 0; i < n / 3; i++) ans[arr[i]] = i;
  for (int i = n / 3; i < 2 * n / 3; i++) ans[arr[i]] = a[arr[i]] - i;
  for (int i = 2 * n / 3; i < n; i++) ans[arr[i]] = a[arr[i]] - (n - 1 - i);
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << a[i] - ans[i] << " ";
  cout << endl;
}
