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