#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, v;
  double a, b, g = 9.8;
  vector<pair<double, long long> > shoot;
  vector<pair<double, double> > wall;
  cin >> n >> v;
  for (long long i = 0; i < ((long long)n); i++) {
    cin >> a;
    shoot.push_back(make_pair(a, i));
  }
  cin >> m;
  for (long long i = 0; i < ((long long)m); i++) {
    cin >> a >> b;
    wall.push_back(make_pair(a, b));
  }
  sort(shoot.begin(), shoot.end());
  sort(wall.begin(), wall.end());
  wall.push_back(make_pair(1 << 25, 0));
  vector<pair<double, double> > ans(n);
  long long pos = 0;
  for (long long i = 0; i < ((long long)((long long)shoot.size())); i++) {
    double vx = v * cos(shoot[i].first);
    double vy = v * sin(shoot[i].first);
    double t = 2 * vy / g;
    while (true) {
      if (vx * t < wall[pos].first) {
        ans[shoot[i].second] = make_pair(vx * t, 0);
        break;
      } else {
        double tt = wall[pos].first / vx;
        double height = vy * tt - g * tt * tt / 2.0;
        if (height <= wall[pos].second) {
          ans[shoot[i].second] = make_pair(wall[pos].first, height);
          break;
        } else {
          pos++;
        }
      }
    }
  }
  for (long long i = 0; i < ((long long)((long long)ans.size())); i++)
    printf("%.11lf %.11lf\n", ans[i].first, ans[i].second);
}
