#include <bits/stdc++.h>
using namespace std;
const double G = 9.8;
struct Pos {
  double x, y;
  bool operator<(Pos cmp) const { return x < cmp.x; }
} pp[100000];
struct cannon {
  double angle;
  int idx;
  bool operator<(cannon cmp) const { return angle < cmp.angle; }
} cc[10000];
double x[10000], y[10000];
int main() {
  int n, V;
  cin >> n >> V;
  for (int i = 0; i < n; i++) {
    cin >> cc[i].angle;
    cc[i].idx = i;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> pp[i].x >> pp[i].y;
  }
  sort(pp, pp + m);
  sort(cc, cc + n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    double vx = V * cos(cc[i].angle);
    double vy = V * sin(cc[i].angle);
    bool flag = false;
    double dis = vx * vy * 2 / G;
    for (int j = s; j < m; j++) {
      if (dis <= pp[j].x) break;
      double t = pp[j].x / vx;
      double yt = vy * t - G * t * t / 2;
      if (yt <= pp[j].y) {
        flag = true;
        x[cc[i].idx] = pp[j].x;
        y[cc[i].idx] = yt;
        break;
      }
      s = j;
    }
    if (!flag) {
      x[cc[i].idx] = dis;
      y[cc[i].idx] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << x[i] << ' ' << y[i] << endl;
  }
  return 0;
}
