#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], x[N], y[N];
pair<int, int> b[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b[i] = {a[i], i};
  }
  sort(b, b + n);
  int m = n / 3 + !!(n % 3);
  for (int i = 0, no; i < m; i++) {
    no = b[i].second;
    x[no] = b[i].first;
    y[no] = 0;
  }
  for (int i = m, no; i < m * 2 && i < n; i++) {
    no = b[i].second;
    x[no] = 0;
    y[no] = b[i].first;
  }
  for (int i = n - 1, no, tp = 1; i >= 2 * m; i--) {
    no = b[i].second;
    y[no] = tp++;
    x[no] = b[i].first - y[no];
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", x[i]);
  puts("");
  for (int i = 0; i < n; i++) printf("%d ", y[i]);
  puts("");
  return 0;
}
