#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10, pi = 3.1415926535897932384626433832795, g = 9.8;
const int n = 100005;
int N, M, i, j;
int P[n], Q[n];
double res, V;
double Alpha[n], X[n], Y[n], Ansx[n], Ansy[n];
int Cmp(const int &i, const int &j) { return Alpha[i] < Alpha[j]; }
int cmp(const int &i, const int &j) { return X[i] < X[j]; }
double Get(int i, double x) {
  double t = x / (V * cos(Alpha[i]));
  double y = V * sin(Alpha[i]) * t - g * t * t / 2;
  return y;
}
void Work(int i) {
  double t = 2 * V * sin(Alpha[i]) / g;
  Ansx[i] = V * cos(Alpha[i]) * t;
  Ansy[i] = 0;
}
int main() {
  scanf("%d%lf", &N, &V);
  for (i = 1; i <= N; ++i) scanf("%lf", &Alpha[i]);
  for (i = 1; i <= N; ++i) Q[i] = i;
  sort(Q + 1, Q + N + 1, Cmp);
  scanf("%d", &M);
  for (i = 1; i <= M; ++i) scanf("%lf%lf", &X[i], &Y[i]);
  for (i = 1; i <= M; ++i) P[i] = i;
  sort(P + 1, P + M + 1, cmp);
  j = 1;
  for (i = 1; i <= M; ++i)
    for (; j <= N && (res = Get(Q[j], X[P[i]])) - eps < Y[P[i]]; ++j)
      Ansx[Q[j]] = X[P[i]], Ansy[Q[j]] = res;
  for (i = 1; i <= N; ++i)
    if (Ansy[i] < eps) Work(i);
  for (i = 1; i <= N; ++i) printf("%.9lf %.9lf\n", Ansx[i], Ansy[i]);
  return 0;
}
