#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  vector<int> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  auto v = s;
  sort(v.rbegin(), v.rend());
  vector<int> val(n);
  int t = (n + 1) / 3;
  for (int i = 0; i < n; i++) {
    val[i] = i & 1 ? v[i] - t : t;
    t -= (i & 1) == 0;
    t = max(t, 0);
  }
  reverse(v.begin(), v.end());
  reverse(val.begin(), val.end());
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    int x = lower_bound(v.begin(), v.end(), s[i]) - v.begin();
    cout << val[x] << " \n"[i + 1 == n];
  }
  for (int i = 0; i < n; i++) {
    int x = lower_bound(v.begin(), v.end(), s[i]) - v.begin();
    cout << s[i] - val[x] << " \n"[i + 1 == n];
  }
  return 0;
}
