#include <bits/stdc++.h>
using namespace std;
struct d {
  double x, y;
  double a;
  bool operator<(const d &b) const { return x < b.x; }
};
int main() {
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(8);
  int n, V;
  cin >> n >> V;
  pair<double, int> a[n];
  for (int i = 0; i < n; i++) {
    double aa;
    cin >> aa;
    a[i] = make_pair(aa, i);
  }
  int m;
  cin >> m;
  d w[m];
  for (int i = 0; i < m; i++) cin >> w[i].x >> w[i].y;
  sort(w, w + m);
  double ans[n][2];
  sort(a, a + n);
  int j = 0;
  for (int i = 0; i < n; i++) {
    double h = a[i].first;
    int ind = a[i].second;
    double tg = 2.0 * V * sin(h) / 9.8;
    double xg = tg * V * cos(h);
    bool done = false;
    while (j < 0) j++;
    for (; j < m; j++) {
      double x = w[j].x, y = w[j].y;
      if (x > xg) {
        ans[ind][0] = xg;
        ans[ind][1] = 0.0;
        done = true;
        break;
      }
      double t = x / cos(h) / V;
      double yy = sin(h) * V * t - 4.9 * t * t;
      if (y >= yy) {
        ans[ind][0] = x;
        ans[ind][1] = yy;
        done = true;
        break;
      }
    }
    if (!done) {
      ans[ind][0] = xg;
      ans[ind][1] = 0.0;
    }
    j--;
  }
  for (int i = 0; i < n; i++) cout << ans[i][0] << " " << ans[i][1] << "\n";
  return 0;
}
