#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int mod = (int)1e+9 + 7;
const double pi = acos(-1.);
const int maxn = 100100;
pair<double, int> alpha[maxn];
double x[maxn], y[maxn];
set<pair<double, double> > st;
double ansx[maxn], ansy[maxn];
int main() {
  {
    srand(time(0));
    const string file = "";
    if (!file.empty()) {
      freopen((file + ".in").c_str(), "r", stdin);
      freopen((file + ".out").c_str(), "w", stdout);
    }
  }
  int n;
  scanf("%d", &n);
  double v;
  scanf("%lf", &v);
  for (int i = 0; i < n; i++) {
    scanf("%lf", &alpha[i].first);
    alpha[i].second = i;
  }
  sort(&alpha[0], &alpha[n]);
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%lf%lf", &x[i], &y[i]);
    st.insert(make_pair(x[i], y[i]));
  }
  for (int i = 0; i < n; i++) {
    int cr = alpha[i].second;
    bool emp = 0;
    double xx, yy;
    while (1) {
      if (st.empty()) {
        emp = 1;
        break;
      }
      double t = (st.begin()->first) / (v * cos(alpha[i].first));
      double y = v * sin(alpha[i].first) * t - 4.9 * ((t) * (t));
      if (y - eps > (st.begin()->second)) {
        st.erase(st.begin());
      } else {
        xx = st.begin()->first;
        yy = y;
        break;
      }
    }
    if (emp || yy < -eps) {
      double t = v * sin(alpha[i].first) / 4.9;
      xx = v * cos(alpha[i].first) * t;
      yy = 0;
    }
    ansx[cr] = xx;
    ansy[cr] = yy;
  }
  for (int i = 0; i < n; i++) {
    printf("%.10lf %.10lf\n", ansx[i], ansy[i]);
  }
  return (0);
}
