use std::collections::hash_set::Iter;
use std::rc::Rc;
use std::ops::DivAssign;
use std::ops::MulAssign;
use std::ops::SubAssign;
use std::collections::BinaryHeap;
use std::str::FromStr;
use std::collections::HashSet;
use std::collections::BTreeMap;
use std::fmt::Display;
use std::ops::Neg;
use std::ops::Div;
use std::ops::Mul;
use std::ops::Add;
use std::ops::{AddAssign, Sub};
use std::cmp::max;
use std::collections::VecDeque;
use std::cmp::min;
use std::collections::{HashMap, BTreeSet};
use std::cmp::Ordering;
use std::fmt::Debug;

fn read_line() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("No Line");
    buffer.trim().to_owned()
}
fn read_lines<T: std::str::FromStr>(count: usize) -> Vec<T> {
    let mut buffer = String::new();
    let mut vec = Vec::with_capacity(count);
    for _ in 0 .. count {
        std::io::stdin().read_line(&mut buffer).expect("No Line");
        vec.push(buffer.trim().parse().ok().expect("Can't Parse"));
        buffer.clear();
    }
    vec
}
fn read_tabulate<R, T: Fn(&str)->R> (count: usize, transformer: T) -> Vec<R> {
    let mut buffer = String::new();
    let mut vec = Vec::with_capacity(count);
    for _ in 0 .. count {
        std::io::stdin().read_line(&mut buffer).expect("No Line");
        vec.push(transformer(buffer.trim()));
        buffer.clear();
    }
    vec
}
fn read_value<T: std::str::FromStr>() -> T {
    read_line().trim().parse().ok().unwrap()
}
fn read_values<T: std::str::FromStr>() -> Vec<T> {
    read_line().trim().split_whitespace().map(|x| x.parse().ok().expect("Can't Parse")).collect::<Vec<T>>()
}
macro_rules! freeze {
    ($($id:ident), *) => {
        $(let $id = $id;)*
    };
}
macro_rules! read_map {
    ($ident: ident: [$block: block; $size: expr]) => {
        let $ident = (0 .. $size).into_iter().map(|_| $block).collect::<Vec<_>>();
    };
    (mut $ident: ident: [$block: block; $size: expr]) => {
        let mut $ident = (0 .. $size).into_iter().map(|_| $block).collect::<Vec<_>>();
    };
}
macro_rules! read {
    (mut $ident: ident: String) => {
        let mut $ident = read_value::<String>();
    };
    ($ident: ident: String) => {
        let $ident = read_value::<String>();
    };
    (mut $ident: ident: [$ty:ty]) => {
        let mut $ident = read_values::<$ty>();
    };
    ($ident: ident: [$ty:ty]) => {
        let $ident = read_values::<$ty>();
    };
    (mut $ident: ident: [[$ty:ty]; $size: expr]) => {
        let mut $ident = (0 .. $size).into_iter().map(|_| read_values::<$ty>()).collect::<Vec<_>>();
    };
    ($ident: ident: [[$ty:ty]; $size: expr]) => {
        let $ident = (0 .. $size).into_iter().map(|_| read_values::<$ty>()).collect::<Vec<_>>();
    };
    (mut $ident: ident: [$ty:ty; $size:expr]) => {
        let mut $ident = read_lines::<$ty>($size);
    };
    ($ident: ident: [$ty:ty; $size:expr]) => {
        let $ident = read_lines::<$ty>($size);
    };
    ($ident: ident: [$block: block; $size: expr]) => {
        let $ident = (0 .. $size).into_iter().map(|_| $block).collect::<Vec<_>>();
    };
    (mut $ident: ident: [$block: block; $size: expr]) => {
        let mut $ident = (0 .. $size).into_iter().map(|_| $block).collect::<Vec<_>>();
    };
    ($($token: tt)*) => {
        let mut iter = read_values::<String>().into_iter();
        read_from_iter!(iter; $($token)*);
    };
}
macro_rules! read_from_iter {
    ($iter:expr; mut $ident:ident:$ty:ty, $($rest:tt)*) => {
        let mut $ident = $iter.next().unwrap().parse::<$ty>().expect("Can't Parse");
        read_from_iter!($iter; $($rest)*);
    };
    ($iter:expr; $ident:ident:$ty:ty, $($rest:tt)*) => {
        let $ident = $iter.next().unwrap().parse::<$ty>().expect("Can't Parse");
        read_from_iter!($iter; $($rest)*);
    };
    ($iter:expr; mut $ident:ident:$ty:ty) => {
        let mut $ident = $iter.next().unwrap().parse::<$ty>().expect("Can't Parse");
    };
    ($iter:expr; $ident:ident:$ty:ty) => {
        let $ident = $iter.next().unwrap().parse::<$ty>().expect("Can't Parse");
    };
    ($iter: expr; ) => {};
}
struct KeyValue<K, V> {
    key: K,
    value: V
}
impl <K: PartialOrd, V> PartialEq for KeyValue<K, V> {
    fn eq(&self, other: &Self) -> bool {
        self.key.eq(&other.key)
    }
}
impl <K: PartialOrd, V> Eq for KeyValue<K, V> {}
impl <K: PartialOrd, V> PartialOrd for KeyValue<K, V> {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        self.key.partial_cmp(&other.key)
    }
}
impl <K: PartialOrd, V> Ord for KeyValue<K, V> {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.key.partial_cmp(&other.key).ok_or("Can't Compare").unwrap()
    }
}


fn push_until_overflow(heights: &mut Vec<f64>, width: &Vec<usize>, faucets: &Vec<f64>, time: f64) {
    for i in 0 .. heights.len() {
        heights[i] += time * faucets[i] as f64 / width[i] as f64 / 30f64;
        if heights[i] > 50f64 {
            heights[i] = 50f64;
        }
    }
}
fn next_overflow_time(heights: &Vec<f64>, width: &Vec<usize>, gates: &Vec<usize>, faucets: &Vec<f64>) -> f64{
    if heights.len() == 1 && (heights[0] - 50f64).abs() < 1e-6 {return 1000001f64;}
    let mut time = 1000001f64;
    for i in 0 .. heights.len() {
        if faucets[i].abs() < 1e-6 {continue;}
        let mut min_height = 50usize;
        if i > 0 {min_height = min(min_height, gates[i - 1]);}
        if i < gates.len() {min_height = min(min_height, gates[i]);}
        let overflow_time = (min_height as f64 - heights[i]) * 30f64 * width[i] as f64 / faucets[i] as f64;
        if overflow_time < time {time = overflow_time;}
    }
    time
}
fn change_faucets_pos(heights: &Vec<f64>, gates: &Vec<usize>, faucets: &mut Vec<f64>) {
    for i in 0 .. heights.len() {
        if i > 0 && i < gates.len() && (heights[i] - gates[i - 1] as f64).abs() < 1e-6 && (heights[i] - gates[i] as f64).abs() < 1e-6{
            faucets[i - 1] += faucets[i] / 2f64;
            faucets[i + 1] += faucets[i] / 2f64;
            faucets[i] = 0f64;
        }else if i > 0 && (heights[i] - gates[i - 1] as f64).abs() < 1e-6 {
            faucets[i - 1] += faucets[i];
            faucets[i] = 0f64;
        }else if i < gates.len() && (heights[i] - gates[i] as f64).abs()  < 1e-6 {
            faucets[i + 1] += faucets[i];
            faucets[i] = 0f64;
        }
    }
}
fn remove_sinked_gate(heights: &mut Vec<f64>, width: &mut Vec<usize>, gates: &mut Vec<usize>, faucets: &mut Vec<f64>) {
    let mut i = 0;
    while i < gates.len() {
        if (gates[i] as f64 - heights[i]).abs() < 1e-6 && (gates[i] as f64 - heights[i + 1]).abs() < 1e-6 {
            let sum_width = width[i] + width[i + 1];
            let sum_faucets = faucets[i] + faucets[i + 1];
            heights.remove(i + 1);
            gates.remove(i);
            width.remove(i + 1);
            width[i] = sum_width;
            faucets.remove(i + 1);
            faucets[i] = sum_faucets;
        }else {
            i += 1;
        }
    }
}


fn main() {
    read!(data_set: usize);
    for _ in 0 .. data_set {
        read!(n: usize);
        read_map!(gates: [{
            read!(b: usize, h: usize);
            (b, h)
        }; n]);
        read!(m: usize);
        read_map!(faucets: [{
            read!(f: usize, a: usize);
            (f, a)
        }; m]);
        read!(l: usize);
        read_map!(watch: [{
            read!(p: usize, t: usize);
            (p, t)
        }; l]);
        let mut he = vec![0f64; n + 1];
        let mut fa = vec![0f64; n + 1];
        let mut ga = gates.iter().map(|&(_, h)| h).collect::<Vec<_>>();
        for (f, a) in faucets {
            if let Some(pos) = (0 .. gates.len()).find(|&i| f <= gates[i].0) {
                fa[pos] += a as f64;
            }else {
                fa[n] += a as f64;
            }
        }
        let mut wi = (0 .. gates.len() + 1).map(|i| if i == 0 { gates[i].0 } else if i == gates.len() {100 - gates[i - 1].0} else {gates[i].0 - gates[i - 1].0}).collect::<Vec<_>>();
        let mut times = (0 .. watch.len()).collect::<Vec<usize>>();
        times.sort_by_key(|&i| watch[i].1);
        let mut current_time = 0f64;
        let mut result = vec![0f64; l];
        for i in times {
            let (p, time) = watch[i];
            let mut overflow_time = next_overflow_time(&he, &wi, &ga, &fa);
            while current_time + overflow_time <= time as f64 {
                push_until_overflow(&mut he, &wi, &fa, overflow_time);
                change_faucets_pos(&he, &ga, &mut fa);
                remove_sinked_gate(&mut he, &mut wi, &mut ga, &mut fa);
                current_time += overflow_time;
                overflow_time = next_overflow_time(&he, &wi, &ga, &fa);
                //println!("time: {:.*}\nheight: {:?}\ngate: {:?}\nwidth: {:?}\nfaucets: {:?}", 3, current_time, he, ga, wi, fa);
            }
            push_until_overflow(&mut he, &wi, &fa, time as f64 - current_time);
            current_time = time as f64;
            //println!("time: {:.*}\nheight: {:?}\ngate: {:?}\nwidth: {:?}\nfaucets: {:?}", 3, current_time, he, ga, wi, fa);
            let mut pos = 0;
            let mut sum_width = 0;
            while sum_width + wi[pos] < p {
                sum_width += wi[pos];
                pos += 1;
            }
            result[i] = he[pos];
        }
        for r in result {
            println!("{:.*}", 10, r);
        }
    }
}


Measured memory_bytes: 5068