#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> node;
const int N = 100005;
node s[N], a[N], b[N];
bool cmp(node a, node b) { return a.second < b.second; }
int main() {
  int i, n, x;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &x);
      s[i] = make_pair(i, x);
    }
    sort(s, s + n, cmp);
    int e = n / 3 + (n % 3 != 0);
    for (i = 0; i < e; i++) {
      int pos = s[i].first, x = s[i].second;
      a[i] = make_pair(pos, i), b[i] = make_pair(pos, x - i);
    }
    for (i = e; i < 2 * e; i++) {
      int pos = s[i].first, x = s[i].second;
      b[i] = make_pair(pos, i), a[i] = make_pair(pos, x - i);
    }
    for (i = 2 * e; i < n; i++) {
      int pos = s[i].first, x = s[i].second;
      b[i] = make_pair(pos, n - 1 - i), a[i] = make_pair(pos, x - b[i].second);
    }
    printf("YES\n");
    sort(a, a + n);
    sort(b, b + n);
    for (i = 0; i < n; i++) printf("%d ", a[i].second);
    printf("\n");
    for (i = 0; i < n; i++) printf("%d ", b[i].second);
    printf("\n");
  }
  return 0;
}
