#include <bits/stdc++.h>
using namespace std;
int N;
int A[200000], B[200000], S[200000];
int idx[200000];
bool cmp(int a, int b) { return S[a] < S[b]; }
int main() {
  scanf("%d", &N);
  for (int Ni = 0; Ni < N; Ni++) scanf("%d", &S[Ni]), idx[Ni] = Ni;
  sort(idx, idx + N, cmp);
  int P = ceil((double)N / 3);
  int i, k = 0;
  for (; k < P; k++) i = idx[k], A[i] = k, B[i] = S[i] - A[i];
  for (; k < 2 * P && k < N; k++) i = idx[k], B[i] = k, A[i] = S[i] - B[i];
  for (int j = P - 1; k < N; k++, j--) i = idx[k], B[i] = j, A[i] = S[i] - B[i];
  puts("YES");
  for (int Ni = 0; Ni < N; Ni++) {
    if (Ni) printf(" ");
    printf("%d", A[Ni]);
  }
  puts("");
  for (int Ni = 0; Ni < N; Ni++) {
    if (Ni) printf(" ");
    printf("%d", B[Ni]);
  }
  puts("");
}
