#include <bits/stdc++.h>
using namespace std;
int n, m, a[200000], b[200000], u[200000];
bool cmp(int i, int j) { return a[i] < a[j]; }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), u[i] = i;
  sort(u, u + n, cmp);
  m = (n + 2) / 3;
  cout << "YES\n";
  for (int i = 0; i < min(m, n); i++) b[u[i]] = a[u[i]] - i;
  for (int i = m; i < min(n, m + m); i++) b[u[i]] = i;
  for (int i = m + m; i < n; i++) b[u[i]] = n - 1 - i;
  for (int i = 0; i < n; i++) cout << b[i] << ' ';
  cout << endl;
  for (int i = 0; i < n; i++) cout << a[i] - b[i] << ' ';
  return 0;
}
