#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > arr, A, B;
  for (int i = 0; i < n; i++) {
    int first;
    scanf("%d", &first);
    arr.push_back({first, i});
  }
  sort(arr.begin(), arr.end());
  int left = (n + 2) / 3;
  int right = n - left * 2;
  for (int i = 0; i < left; i++) {
    A.push_back({arr[i].second, arr[i].first});
    B.push_back({arr[i].second, 0});
  }
  for (int i = left; i < left * 2 && i < n; i++) {
    B.push_back({arr[i].second, arr[i].first});
    A.push_back({arr[i].second, 0});
  }
  for (int i = left * 2; i < n; i++) {
    A.push_back({arr[i].second, arr[i].first - (n - 1 - i)});
    B.push_back({arr[i].second, n - 1 - i});
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  puts("YES");
  for (auto first : A) printf("%d ", first.second);
  puts("");
  for (auto first : B) printf("%d ", first.second);
  puts("");
}
