#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n;
struct data {
  int i, s, a, b;
} d[maxn];
bool cmp1(data i, data j) { return i.s < j.s; }
bool cmp2(data i, data j) { return i.i < j.i; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i].s;
    d[i].i = i;
  }
  sort(d, d + n, cmp1);
  for (int i = 0; i < n; i++)
    if (i < n / 3) {
      d[i].a = i;
      d[i].b = d[i].s - i;
    } else if (i < 2 * n / 3) {
      d[i].b = i;
      d[i].a = d[i].s - i;
    } else {
      d[i].b = n - 1 - i;
      d[i].a = d[i].s - d[i].b;
    }
  sort(d, d + n, cmp2);
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << d[i].a << " ";
  cout << "\n";
  for (int i = 0; i < n; i++) cout << d[i].b << " ";
  cout << "\n";
  return 0;
}
