#include <bits/stdc++.h>
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
double Theta[10005];
double Tan[10005];
double Cos2[10005];
double EndX[10005];
double V;
double G = 9.8;
int Order[10005];
int N, M;
bool Cmp(int X, int Y) { return Theta[X] < Theta[Y]; }
std::pair<double, double> Wall[100005];
std::pair<double, double> Ans[100005];
void Init() {
  Get(N);
  scanf("%lf", &V);
  for (int i = 1; i <= N; i++) {
    scanf("%lf", &Theta[i]);
    Cos2[i] = cos(Theta[i]);
    Cos2[i] *= Cos2[i];
    Tan[i] = tan(Theta[i]);
    EndX[i] = V * V * sin(2 * Theta[i]) / G;
    Order[i] = i;
  }
  std::sort(Order + 1, Order + N + 1, Cmp);
  Get(M);
  for (int i = 1; i <= M; i++) {
    scanf("%lf%lf", &Wall[i].first, &Wall[i].second);
  }
  std::sort(Wall + 1, Wall + M + 1);
  Wall[++M] = std::make_pair(1e60, 0);
}
void Work() {
  for (int k = 1, j = 1; j <= M; j++) {
    for (; k <= N;) {
      int i = Order[k];
      if (EndX[i] < Wall[j].first) {
        Ans[i] = std::make_pair(EndX[i], 0);
        k++;
      } else {
        double Y0 = Tan[i] * Wall[j].first -
                    G * Wall[j].first * Wall[j].first / (2 * V * V * Cos2[i]);
        if (Y0 < Wall[j].second + 1e-8) {
          Ans[i] = std::make_pair(Wall[j].first, Y0);
          k++;
        } else
          break;
      }
    }
  }
}
void Output() {
  for (int i = 1; i <= N; i++) printf("%lf %lf\n", Ans[i].first, Ans[i].second);
}
int main() {
  Init();
  Work();
  Output();
  return 0;
}
