#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-12;
typedef struct data {
  double ang;
  int id;
  bool operator<(const data& d) const { return ang < d.ang; }
} Data;
typedef struct point {
  double x, y;
  void read() { scanf("%lf%lf", &x, &y); }
  bool operator<(const point& p) const { return x < p.x; }
} Point;
multiset<Data> S;
multiset<Data>::iterator it;
Point P[100001], ans[100001];
Data dat[100001], tmp;
int n, m;
double v, g = 9.8, PI = acos(-1.0);
double cal(double ang, double x) {
  double t = x / cos(ang) / v;
  return v * sin(ang) * t - 0.5 * g * t * t;
}
int main() {
  scanf("%d", &n);
  scanf("%lf", &v);
  for (int i = 0; i < n; i++) scanf("%lf", &dat[i].ang), dat[i].id = i;
  for (int i = 0; i < n; i++) S.insert(dat[i]);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) P[i].read();
  sort(P, P + m);
  for (int i = 0; i < m; i++) {
    while (!S.empty() && v * v / g * sin(S.begin()->ang * 2) - P[i].x <= -EPS) {
      it = S.begin();
      ans[it->id].x = v * v / g * sin(2 * it->ang);
      ans[it->id].y = 0.0;
      S.erase(it);
    }
    if (!S.empty()) {
      int ct = 0;
      double l = 0, r = PI / 4, m;
      while (ct < 100) {
        m = (l + r) / 2;
        if (cal(m, P[i].x) - P[i].y < EPS)
          l = m;
        else
          r = m;
        ct++;
      }
      tmp.ang = r;
      while (!S.empty()) {
        it = S.upper_bound(tmp);
        if (it != S.begin()) it--;
        if (it->ang < r) {
          ans[it->id].x = P[i].x;
          ans[it->id].y = cal(it->ang, P[i].x);
          S.erase(it);
        } else
          break;
      }
    }
  }
  while (!S.empty()) {
    it = S.begin();
    ans[it->id].x = v * v / g * sin(2 * it->ang);
    ans[it->id].y = 0.0;
    S.erase(it);
  }
  for (int i = 0; i < n; i++) printf("%.10lf %.10lf\n", ans[i].x, ans[i].y);
  return 0;
}
