#include <bits/stdc++.h>
using namespace std;
void bug() { cout << " " << endl; }
template <class T>
void bug(T a) {
  cout << a << "  ";
}
template <class T>
void bug(T* a, int n) {
  for (int i = 0; i < (n); i++) bug(a[i]);
}
int n, b[1111111], c[1111111];
pair<int, int> v[1111111];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v, v + n);
  int m = (n * 2) / 3;
  for (int i = 0; i < (n - m); i++) {
    int j = v[i].second;
    b[j] = v[i].first;
    c[j] = 0;
  }
  int k = 0;
  for (int i = n - m; i < n; i += 2) {
    int j = v[i].second;
    b[j] = v[i].first - k;
    c[j] = k;
    if (i + 1 < n) {
      j = v[i + 1].second;
      c[j] = v[i + 1].first - k;
      b[j] = k;
    }
    k++;
  }
  cout << "YES" << endl;
  for (int i = 0; i < (n); i++) cout << b[i] << " ";
  cout << endl;
  for (int i = 0; i < (n); i++) cout << c[i] << " ";
  cout << endl;
  return 0;
}
