#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k;
  cin >> n;
  vector<pair<int, int> > v(n);
  vector<int> a(n), b(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  for (i = 0; i < (n + 2) / 3; i++) {
    a[v[i].second] = v[i].first;
    b[v[i].second] = 0;
  }
  for (j = 0; i < n; i++) {
    if (i % 2) {
      a[v[i].second] = 0;
      b[v[i].second] = v[i].first;
    } else {
      a[v[i].second] = v[i].first - j;
      b[v[i].second] = j++;
    }
  }
  cout << "YES" << endl;
  for (int(i) = 0; (i) < (n); (i)++) cout << a[i] << " ";
  cout << endl;
  for (int(i) = 0; (i) < (n); (i)++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
