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