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