import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  int[] X = readln.chomp.split.to!(int[]);
  int[] sortX = X.dup;
  sort(sortX);

  if (N == 2) {
    writeln(sortX[1]);
    writeln(sortX[0]);
    return;
  }

  int[] A = sortX[(N / 2 - 2)..(N / 2 + 2)];

  foreach (int a; X) {
    if (a <= A[1]) {
      writeln(A[2]);
    }
    else if (a >= A[2]) {
      writeln(A[1]);
    }
  }
}
