#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;
const long double eps = 1e-9;
const long double pi = fabs(atan2(0.0, -1.0));
const double g = 9.8;
int n, v;
vector<pair<double, int> > shot;
int m;
vector<pair<double, double> > wall;
void Load() {
  scanf("%d%d", &n, &v);
  for (int i = 0; i < n; i++) {
    double a;
    scanf("%lf", &a);
    shot.push_back(make_pair(a, i));
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    double x, y;
    scanf("%lf%lf", &x, &y);
    wall.push_back(make_pair(x, y));
  }
}
bool up(int i, int j) {
  double t = wall[j].first / (v * cos(shot[i].first));
  double y = v * sin(shot[i].first) * t - g * ((t) * (t)) / 2.0;
  return y > wall[j].second;
}
pair<double, double> get(int i, int j) {
  if (j >= m) {
    double t = 2 * v * sin(shot[i].first) / g;
    return make_pair(v * cos(shot[i].first) * t, 0.0);
  } else {
    double t = wall[j].first / (v * cos(shot[i].first));
    double y = v * sin(shot[i].first) * t - g * ((t) * (t)) / 2.0;
    if (y < 0) {
      t = 2 * v * sin(shot[i].first) / g;
    }
    return make_pair(v * cos(shot[i].first) * t,
                     v * sin(shot[i].first) * t - g * ((t) * (t)) / 2.0);
  }
}
void Solve() {
  sort(shot.begin(), shot.end());
  sort(wall.begin(), wall.end());
  vector<pair<double, double> > ans(n);
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < m && up(i, j)) j++;
    ans[shot[i].second] = get(i, j);
  }
  for (int i = 0; i < n; i++)
    printf("%.10lf %.10lf\n", ans[i].first, ans[i].second);
}
int main() {
  Load();
  Solve();
  return 0;
}
