#include <bits/stdc++.h>
using namespace std;
const double g = 9.8;
int n, m;
double v, alpha;
pair<double, double> w[100005], ans[10005];
set<pair<double, int> > s;
double calc(double alpha) {
  return 2 * ((v) * (v)) * sin(alpha) * cos(alpha) / g;
}
double calc(double alpha, double x) {
  return x * tan(alpha) -
         g * ((x) * (x)) / (2 * ((v) * (v)) * ((cos(alpha)) * (cos(alpha))));
}
int main() {
  cin >> n >> v;
  for (int i = 1; i <= n; ++i) {
    scanf("%lf", &alpha);
    ans[i] = make_pair(calc(alpha), 0.0), s.insert(make_pair(alpha, i));
  }
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    scanf("%lf%lf", &w[i].first, &w[i].second);
  }
  sort(w + 1, w + m + 1);
  for (int i = 1; i <= m; ++i) {
    while (!s.empty()) {
      auto j = s.begin();
      double h = calc(j->first, w[i].first);
      if (h > w[i].second) break;
      ans[j->second] = min(ans[j->second], make_pair(w[i].first, h));
      s.erase(j);
    }
  }
  for (int i = 1; i <= n; ++i)
    printf("%.9lf %.9lf\n", ans[i].first, ans[i].second);
  return 0;
}
