#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> s[100000];
int a[100000], b[100000];
int main() {
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  int x = (n + 2) / 3;
  for (int i = 0; i < (int)(n); i++) {
    int k = s[i].second;
    if (i < x) {
      a[k] = 0;
      b[k] = s[i].first;
    } else if (i < x + x) {
      a[k] = s[i].first;
      b[k] = 0;
    } else {
      a[k] = n - 1 - i;
      b[k] = s[i].first - a[k];
    }
  }
  puts("YES");
  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;
}
