#include using namespace std; const int N = 15; double a[N], c[N], d[N]; int b[N], cl, dl; int main() { int n = 10; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; for (int i = 1; i <= n; i++) if (b[i] == 1) c[++cl] = a[i]; else d[++dl] = a[i]; sort(c + 1, c + 1 + 5); sort(d + 1, d + 1 + 5, greater()); for (int i = 1; i <= 5; i++) printf("%d %.2f\n", 1, c[i]); for (int i = 1; i <= 5; i++) printf("%d %.2f\n", 1, c[i]); return 0; }