#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long INF = 1e18;
const long double EPS = 1e-12;
vector<pair<int, int> > vec;
int a[100005];
int b[100005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < (int)n; i++) {
    int x;
    cin >> x;
    vec.push_back(make_pair(x, i));
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < (int)(n + 2) / 3; i++) {
    int idx = vec[i].second;
    a[idx] = i;
    b[idx] = (vec[i].first) - i;
  }
  for (int i = (int)((n + 2) / 3); i < (int)n - ((n + 2) / 3); i++) {
    int idx = vec[i].second;
    b[idx] = i;
    a[idx] = (vec[i].first) - i;
  }
  for (int i = (int)n - ((n + 2) / 3); i < (int)n; i++) {
    int idx = vec[i].second;
    b[idx] = n - i - 1;
    a[idx] = (vec[i].first) - b[idx];
  }
  cout << "YES" << endl;
  for (int i = 0; i < (int)n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  for (int i = 0; i < (int)n; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}
