#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-9;
double zero(double d) { return d < EPS ? 0.0 : d; }
int main() {
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(7);
  int n;
  cin >> n;
  int c1, c2, c3;
  c1 = c2 = c3 = n / 3;
  if (n % 3 == 1)
    c1++;
  else if (n % 3 == 2) {
    c1++;
    c2++;
  }
  vector<int> s, t;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    s.push_back(a);
    t.push_back(a);
  }
  sort((s).begin(), (s).end());
  map<int, int> m1, m2;
  int a[n], b[n];
  for (int i = 0; i < c1; ++i) {
    m1[s[i]] = i;
    m2[s[i]] = s[i] - i;
  }
  for (int i = c1; i < c1 + c2; i++) {
    m2[s[i]] = i;
    m1[s[i]] = s[i] - i;
  }
  for (int i = c1 + c2; i < n; i++) {
    m2[s[i]] = n - i - 1;
    m1[s[i]] = s[i] - (n - i - 1);
  }
  cout << "YES" << endl;
  for (int i = 0; i < n - 1; ++i) {
    cout << m1[t[i]] << " ";
  }
  cout << m1[t[n - 1]] << endl;
  for (int i = 0; i < n - 1; ++i) {
    cout << m2[t[i]] << " ";
  }
  cout << m2[t[n - 1]] << endl;
  return 0;
}
