#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
pair<int, int> s[MAXN];
int a[MAXN], b[MAXN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  int q = 0;
  for (int i = 0; i < n; i++) {
    if (i < ceil((double)n / 3.0)) {
      a[s[i].second] = 0;
      b[s[i].second] = s[i].first;
    }
    if (ceil((double)n / 3.0) <= i && i < 2 * ceil((double)n / 3.0)) {
      a[s[i].second] = s[i].first;
      b[s[i].second] = 0;
    }
    if (i >= 2 * ceil((double)n / 3.0)) {
      q = n - i - 1;
      a[s[i].second] = q;
      b[s[i].second] = s[i].first - q;
    }
  }
  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;
}
