#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, tmp;
  cin >> n;
  int a[n], b[n];
  vector<pair<int, int> > s;
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> tmp;
    s.push_back(pair<int, int>(tmp, i));
  }
  if (n == 1) {
    cout << "YES" << '\n';
    cout << s[0].first << '\n';
    cout << 0;
    return 0;
  }
  if (n != 4) {
    for (int(i) = 0; (i) < (n); (i)++) {
      a[i] = -1;
      b[i] = -1;
    }
    int X = n - 2 * ceil(n / 3.0);
    int Y = 2 * n - 3 * ceil(n / 3.0) - 2;
    for (int i = 0; i < X; i++) {
      a[i] = i;
    }
    for (int i = 0; i < X - 1; i++) {
      a[X + 2 * i + 1] = X + i;
    }
    for (int i = 3 * X - 3 + 1; i <= Y; i++) {
      a[i] = i - (X - 1);
    }
    int cur = X;
    for (int i = 0; i < n; i++) {
      if (a[i] == -1) {
        b[i] = cur;
        cur++;
        a[i] = i - b[i];
      } else {
        b[i] = i - a[i];
      }
    }
  } else if (n == 4) {
    a[0] = 0;
    a[1] = 0;
    a[2] = 1;
    a[3] = 1;
    b[0] = 0, b[1] = 1;
    b[2] = 1;
    b[3] = 2;
  }
  sort(s.begin(), s.begin() + s.size());
  int aa[n], bb[n];
  for (int i = 0; i < n; i++) {
    int val = s[i].first, loc = s[i].second;
    aa[loc] = a[i] + (val - i);
    bb[loc] = b[i];
  }
  cout << "YES" << '\n';
  for (int(i) = 0; (i) < (n); (i)++) {
    cout << aa[i] << " ";
  }
  cout << '\n';
  for (int(i) = 0; (i) < (n); (i)++) {
    cout << bb[i] << " ";
  }
  return 0;
}
