#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
pair<int, int> s[MAXN];
int a[MAXN];
int b[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  int k = (n + 2) / 3;
  int ind = k - 1;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      a[s[i].second] = s[i].first;
      b[s[i].second] = 0;
    } else if (i < 2 * k) {
      a[s[i].second] = 0;
      b[s[i].second] = s[i].first;
    } else {
      a[s[i].second] = s[i].first - ind;
      b[s[i].second] = ind--;
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cout << ' ';
    }
    cout << a[i];
  }
  cout << '\n';
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cout << ' ';
    }
    cout << b[i];
  }
  cout << '\n';
}
