#include <bits/stdc++.h>
using namespace std;
const int MAXN = 11000;
int n, m;
double v;
vector<pair<double, int> > af;
vector<pair<double, double> > wall;
double ans[MAXN][2];
double Get(double alp, double sx) {
  double res = sx * tan(alp);
  double tmp = sx / v / cos(alp);
  return res - 4.9 * tmp * tmp;
}
double Get(double alp) {
  double vy = v * sin(alp);
  double t = vy / 9.8 * 2;
  return v * cos(alp) * t;
}
int main() {
  scanf("%d%lf", &n, &v);
  for (int i = 0; i < n; i++) {
    pair<double, int> tmp;
    scanf("%lf", &tmp.first);
    tmp.second = i;
    af.push_back(tmp);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    pair<double, double> tmp;
    scanf("%lf%lf", &tmp.first, &tmp.second);
    wall.push_back(tmp);
  }
  sort(af.begin(), af.end());
  sort(wall.begin(), wall.end());
  for (int i = 0; i < n; i++) {
    static int pos = 0;
    for (; pos < m; pos++) {
      double sy = Get(af[i].first, wall[pos].first);
      if (sy + (1e-8) < wall[pos].second) {
        ans[af[i].second][0] = wall[pos].first;
        ans[af[i].second][1] = sy;
        break;
      }
    }
    if (pos == m || ans[af[i].second][1] - (1e-8) < 0.0) {
      ans[af[i].second][0] = Get(af[i].first);
      ans[af[i].second][1] = 0.0;
    }
  }
  for (int i = 0; i < n; i++) printf("%.10f %.10f\n", ans[i][0], ans[i][1]);
  return 0;
}
