#include <bits/stdc++.h>
using namespace std;
typedef struct fires {
  double angle;
  int index;
} Fire;
vector<pair<double, double> > walls;
pair<double, double> ans[(1 << 15)];
Fire fire[(1 << 15)];
double getmaxdist(Fire f, double V);
double gety(Fire f, double x, double V);
static bool cmp(const Fire &a, const Fire &b) { return (a.angle < b.angle); }
int main(int argc, char *argv[]) {
  int n, i, j, m;
  double V;
  scanf("%d %lf", &n, &V);
  for (i = 1; i <= n; i++) {
    scanf("%lf", &fire[i].angle);
    fire[i].index = i;
  }
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    double x, y;
    scanf("%lf %lf", &x, &y);
    walls.push_back(pair<double, double>(x, y));
  }
  sort(fire + 1, fire + n + 1, cmp);
  sort(walls.begin(), walls.end());
  i = 1;
  j = 0;
  while (i <= n && j < m) {
    if (getmaxdist(fire[i], V) <= walls[j].first) {
      ans[fire[i].index] = pair<double, double>(getmaxdist(fire[i], V), 0.0);
      i++;
    } else {
      double y = gety(fire[i], walls[j].first, V);
      if (y <= walls[j].second) {
        ans[fire[i].index] = pair<double, double>(walls[j].first, y);
        i++;
      } else {
        j++;
      }
    }
  }
  while (i <= n) {
    ans[fire[i].index] = pair<double, double>(getmaxdist(fire[i], V), 0.0);
    i++;
  }
  for (i = 1; i <= n; i++) {
    printf("%lf %lf\n", ans[i].first, ans[i].second);
  }
  return 0;
}
double gety(Fire f, double x, double V) {
  double t = x / (V * cos(f.angle));
  return V * sin(f.angle) * t - 4.9 * t * t;
}
double getmaxdist(Fire f, double V) {
  return 2 * V * V * sin(f.angle) * cos(f.angle) / 9.8;
}
