extern crate core;
     
    use std::fmt;
    use std::cmp::{Ordering, min, max};
    use std::fmt::{Display, Error, Formatter};
    use std::f32::MAX;
    use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut};
    use std::collections::{BTreeMap, VecDeque, BinaryHeap};
     
    fn show<T: Display>(vec: &Vec<T>) {
        if vec.is_empty() {
            println!("[]");
        }else {
            print!("[{}", vec[0]);
            for i in 1 .. vec.len() {
                print!(", {}", vec[i]);
            }
            println!("]");
        }
    }
    fn show2<T: Display>(vec: &Vec<Vec<T>>) {
        if vec.is_empty() {
            println!("[]");
        }else {
            for l in vec {
                show(l);
            }
        }
    }
    macro_rules! read_line{
        () => {{
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).ok();
            line
        }};
        (delimiter: ' ') => {
            read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
        };
        (delimiter: $p:expr) => {
            read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
        };
        (' ') => {
            read_line!(delimiter: ' ')
        };
        ($delimiter:expr) => {
            read_line!(delimiter: $delimiter)
        };
        (' '; $ty:ty) => {
            read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
        };
        ($delimiter:expr; $ty:ty) => {
            read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
        };
    }
    macro_rules! read_value{
        () => {
            read_line!().trim().parse().ok().unwrap()
        }
    }
    macro_rules! let_all {
        ($($n:ident:$t:ty),*) => {
            let line = read_line!(delimiter: ' ');
            let mut iter = line.iter();
            $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
        };
    }
    macro_rules! let_mut_all {
        ($($n:ident:$t:ty),*) => {
            let line = read_line!(delimiter: ' ');
            let mut iter = line.iter();
            $(let mut $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
        };
    }
    const EPSILON: f64 = 0.000000001;
    #[derive(Copy, Clone)]
    struct Point {
        x: f64, y: f64
    }
    impl Point {
        fn distance(&self, other: &Self) -> f64 {
            ((self.x - other.x) * (self.x - other.x) + (self.y - other.y) * (self.y - other.y)).sqrt()
        }
        fn mul(&self, multiple: f64) -> Point {
            Point{x: self.x * multiple, y: self.y * multiple}
        }
    }
    impl Add for Point {
        type Output = Point;
        fn add(self, rhs: Self) -> Self::Output {
            Point{x: self.x + rhs.x, y: self.y + rhs.y}
        }
    }
    impl Sub for Point {
        type Output = Vector;
        fn sub(self, rhs: Self) -> Self::Output {
            Vector{x: self.x - rhs.x, y: self.y - rhs.y}
        }
    }
    #[derive(Copy, Clone)]
    struct Vector {
        x: f64, y: f64
    }
    impl Vector {
        fn dot(&self, other: &Self) -> f64 {
            self.x * other.x + self.y * other.y
        }
        fn cross(&self, other: &Self) -> f64 {
            self.x * other.y - self.y * other.x
        }
        fn length(&self) -> f64 {
            (self.x * self.x + self.y * self.y).sqrt()
        }
        fn angle_between(&self, other: &Self) -> Angle {
            let d = self.length() * other.length();
            Angle{sin: self.cross(other) / d, cos: self.dot(other) / d}
        }
        fn angle(&self) -> Angle {
            let d = self.length();
            Angle{sin: self.y / d, cos: self.x / d}
        }
        fn from(&self, point: &Point) -> Point {
            Point{x: self.x + point.x, y: self.y + point.y}
        }
    }
     
    struct Angle {
        sin: f64, cos: f64
    }
    impl Angle {
        fn rotate90(&self) -> Angle {
            Angle{sin: -self.cos, cos: self.sin}
        }
    }
    impl Add for Angle {
        type Output = Angle;
        fn add(self, rhs: Self) -> Self::Output {
            Angle{sin: self.sin * rhs.cos + self.cos * rhs.sin, cos: self.cos * rhs.cos - self.sin * rhs.sin}
        }
    }
    struct Line{
        a: f64, b: f64, c: f64
    }
    impl Line {
        fn by_two_point(a: &Point, b: &Point) -> Line{
            Line{a: a.y - b.y, b: b.x - a.x, c: a.x * b.y - a.y * b.x}
        }
        fn by_point_and_angle(point: &Point, angle: &Angle) -> Line {
            Line{a: angle.sin, b: -angle.cos, c: angle.cos * point.y - angle.sin * point.x}
        }
        fn angle(&self) -> Angle {
            let d = (self.a * self.a + self.b * self.b).sqrt();
            Angle{sin: self.a / d, cos: -self.b / d}
        }
        fn is_parallel(&self, other: &Self) -> bool {
            (self.a * other.b - self.b * other.a).abs() <= EPSILON
        }
        fn cross_point(&self, other: &Self) -> Option<Point> {
            if self.is_parallel(&other) {
                None
            }else {
                let d = self.a * other.b - self.b * other.a;
                Some(Point{x: (self.b * other.c - self.c * other.b) / d, y: (self.c * other.a - self.a * other.c) / d})
            }
        }
        fn distance(&self, other: &Point) -> f64 {
            (self.a * other.x + self.b * other.y + self.c).abs() / (self.a * self.a + self.b * self.b).sqrt()
        }
    }
    struct BulletLine {
        from: Point, to: Point, line: Line
    }
    impl BulletLine {
        fn is_cross(&self, by_dol: &ByDol) -> bool {
            self.line.distance(&by_dol.position) <= EPSILON &&
                self.from.distance(&by_dol.position) <= self.from.distance(&self.to) &&
                self.to.distance(&by_dol.position) <= self.from.distance(&self.to)
        }
        fn new(from: &Point, to: &Point) -> BulletLine {
            BulletLine{from: *from, to: *to, line: Line::by_two_point(from, to)}
        }
    }
    struct ByDol {
        position: Point, bullet: Bullet, score: i32
    }
    impl Display for Point {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "Point(x: {}, y: {})", self.x, self.y)
        }
    }
    impl Display for ByDol {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "ByDol(position: {}, score: {})", self.position, self.score)
        }
    }
    impl Display for BulletLine {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "Bullet(from: {}, to: {})", self.from, self.to)
        }
    }
    impl Display for Wall {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "Wall(position: {}, size: {})", self.position, self.size)
        }
    }
    impl Display for Line {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "Line(a: {}, b: {}, c: {})", self.a, self.b, self.c)
        }
    }
    impl ByDol {
        fn bullet_line(&self, enemy: &Self) -> Option<BulletLine> {
            if self.position.distance(&enemy.position) <= self.bullet.length + EPSILON {
                Some(BulletLine::new(&self.position, &enemy.position))
            }else {
                None
            }
        }
        fn bullet_line_with_wall(&self, enemy: &Self, wall: &Wall) -> Option<(BulletLine, BulletLine)> {
            if let Bullet { bullet_type: BulletType::Reflective, length: _, count: _ } = self.bullet {
                if let Some(reflection_point) = wall.reflection_point(&self, enemy) {
                    if self.position.distance(&reflection_point) + enemy.position.distance(&reflection_point) <= self.bullet.length + EPSILON {
                        Some((BulletLine::new(&self.position, &reflection_point), BulletLine::new(&reflection_point, &enemy.position)))
                    } else {
                        None
                    }
                } else {
                    None
                }
            }else {
                None
            }
        }
    }
    struct Wall {
        position: Point, size: f64
    }
    impl Wall {
        fn is_barrier(&self, bullet_line: &BulletLine) -> bool {
            if self.position.distance(&bullet_line.from) < self.size - EPSILON || self.position.distance(&bullet_line.to) < self.size - EPSILON {
                true
            }else {
                if let Some(cathetus) = Line::by_point_and_angle(&self.position, &bullet_line.line.angle().rotate90()).cross_point(&bullet_line.line) {
                    let length = bullet_line.from.distance(&bullet_line.to) - EPSILON;
                    bullet_line.from.distance(&cathetus) < length && bullet_line.to.distance(&cathetus) < length && cathetus.distance(&self.position) < self.size - EPSILON
                }else {
                    panic!()
                }
            }
        }
        fn reflection_point(&self, from: &ByDol, to: &ByDol) -> Option<Point> {
            if let Some(bullet_line) = from.bullet_line(to) {
                if self.is_barrier(&bullet_line) {
                    None
                }else {
                    let mut left = from.position;
                    let mut right = to.position;
                    let mut last = left;
                    while (left.x - right.x) * (left.x - right.x) + (left.y - right.y) * (left.y - right.y) > EPSILON * EPSILON {
                        let mid = (left + right).mul(0.5);
                        let Angle{sin, cos} = (mid - self.position).angle();
                        let point = self.position + Point{x: cos * self.size, y: sin * self.size };
                        last = point;
                        let a = (from.position - point).angle_between(&(mid - point));
                        let b = (to.position - point).angle_between(&(mid - point));
                        if a.cos > b.cos {
                            left = mid;
                        }else {
                            right = mid;
                        }
                    }
                    Some(last)
                }
            }else {
                None
            }
        }
    }
     
    enum BulletType {
        Normal, Reflective
    }
    struct Bullet {
        bullet_type: BulletType, length: f64, count: usize,
    }
    fn calculate_score(attacker: &Vec<ByDol>, defender: &Vec<ByDol>, walls: &Vec<Wall>) -> Vec<Vec<i32>> {
        let mut result = vec![vec![0_i32; defender.len()]; attacker.len()];
        for a in 0 .. attacker.len() {
            for d in 0 .. defender.len() {
                let mut can_shoot = false;
                if let Some(bullet_line) = attacker[a].bullet_line(&defender[d]) {
                    can_shoot = true;
                    for wall in walls {
                        if wall.is_barrier(&bullet_line) {
                            //println!("barrier by ByDol W1 {}, attacker: {}, defender: {}", wall, attacker[a], defender[d]);
                            can_shoot = false;
                            break
                        }
                    }
                    if can_shoot {
                        for a2 in 0 .. attacker.len() {
                            if a != a2 && bullet_line.is_cross(&attacker[a2]) {
                                //println!("barrier by ByDol A1 {}, attacker: {}, defender: {}", attacker[a2], attacker[a], defender[d]);
                                can_shoot = false;
                                break
                            }
                        }
                    }
                    if can_shoot {
                        for d2 in 0 .. defender.len() {
                            if d != d2 && bullet_line.is_cross(&defender[d2]) {
                                //println!("barrier by ByDol D1 {}, attacker: {}, defender: {}", defender[d2], attacker[a], defender[d]);
                                can_shoot = false;
                                break
                            }
                        }
                    }
                }else {
                    //println!("cant shoot directory attacker: {}, defender: {}", attacker[a], defender[d]);
                }
                if !can_shoot {
                    for w in 0 .. walls.len() {
                        if let Some((bullet1, bullet2)) = attacker[a].bullet_line_with_wall(&defender[d], &walls[w]) {
                            //println!("reflex shot attacker: {}, defender: {}, wall: {}, {}, {}", attacker[a], defender[d], walls[w], bullet1, bullet2);
                            can_shoot = true;
                            for w2 in 0 .. walls.len() {
                                if w != w2 && (walls[w2].is_barrier(&bullet1) || walls[w2].is_barrier(&bullet2)) {
                                    //println!("barrier by ByDol W2 {}, attacker: {}, defender: {}", walls[w2], attacker[a], defender[d]);
                                    can_shoot = false;
                                    break
                                }
                            }
                            if can_shoot {
                                for a2 in 0 .. attacker.len() {
                                    if a != a2 && (bullet1.is_cross(&attacker[a2]) || bullet2.is_cross(&attacker[a2])) {
                                        //println!("barrier by ByDol A2 {}, attacker: {}, defender: {}", attacker[a2], attacker[a], defender[d]);
                                        can_shoot = false;
                                        break
                                    }
                                }
                            }
                            if can_shoot {
                                for d2 in 0 .. defender.len() {
                                    if d != d2 && (bullet1.is_cross(&defender[d2]) || bullet2.is_cross(&defender[d2])) {
                                        //println!("barrier by ByDol D2 {}, attacker: {}, defender: {}", defender[d2], attacker[a], defender[d]);
                                        can_shoot = false;
                                        break
                                    }
                                }
                            }
                        }
                        if can_shoot {
                            break
                        }
                    }
                }
                if can_shoot {
                    result[a][d] = defender[d].score;
                } else {
                    //println!("no bullet line from {} to {}", a, d);
                }
            }
        }
        result
    }
    #[derive(Copy, Clone)]
    struct Edge {
        to: usize, pair: usize, flow: i32, cost: i32
    }
    impl Display for Edge {
        fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
            write!(f, "Edge(to: {}, pair: {}, flow: {}, cost: {})", self.to, self.pair, self.flow, self.cost)
        }
    }
    struct KeyValue<K, V> {
        key: K, value: V
    }
    impl <K: Ord, V> Ord for KeyValue<K, V> {
        fn cmp(&self, other: &Self) -> Ordering {
            other.key.cmp(&self.key)
        }
    }
    impl <K: PartialOrd, V> PartialOrd for KeyValue<K, V> {
        fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
            other.key.partial_cmp(&self.key)
        }
    }
    impl <K: PartialEq, V> PartialEq for KeyValue<K, V> {
        fn eq(&self, other: &Self) -> bool {
            other.key.eq(&self.key)
        }
    }
    impl <K: Eq, V> Eq for KeyValue<K, V> {}
    fn max_cost_matching(shoot_count: &Vec<i32>, scores: &Vec<Vec<i32>>) -> i32 {
        //show2(&scores);
        let source = scores.len() + scores[0].len();
        let drain = source + 1;
        let mut nodes = vec![Vec::new(); drain + 1];
        for j in scores.len() .. source {
            let len = nodes[drain].len();
            nodes[j].push(Edge{to: drain, pair: len, flow: 1, cost: 0});
            nodes[drain].push(Edge{to: j, pair: 0, flow: 0, cost: 0});
        }
        for i in 0 .. scores.len() {
            let len = nodes[source].len();
            nodes[i].push(Edge{to: source, pair: len, flow: 0, cost: 0});
            nodes[source].push(Edge{to: i, pair: 0, flow: shoot_count[i], cost: 0});
            for j in scores.len() .. source {
                if scores[i][j - scores.len()] != 0 {
                    let len_j = nodes[j].len();
                    let len_i = nodes[i].len();
                    nodes[i].push(Edge{to: j, pair: len_j, flow: 1, cost: 100 - scores[i][j - scores.len()]});
                    nodes[j].push(Edge{to: i, pair: len_i, flow: 0, cost: scores[i][j - scores.len()] - 100});
                }
            }
        }
        let mut potential = vec![0; drain + 1];
        let mut min_cost = vec![std::i32::MAX; drain + 1];
        let mut prev = vec![0; drain + 1];
        let mut queue = BinaryHeap::new();
        let mut score = 0;
        loop {
            for i in 0 .. source {
                min_cost[i] = std::i32::MAX;
            }
            min_cost[source] = 0;
            min_cost[drain] = std::i32::MAX;
            queue.push(KeyValue { key: 0, value: source });
            while let Some(KeyValue{key: cost, value: current}) = queue.pop() {
                if min_cost[current] == cost {
                    for &Edge{to: next, pair: pair, flow: flow, cost: additional} in &nodes[current] {
                        if flow > 0 && min_cost[next] > potential[current] - potential[next] + cost + additional {
                            min_cost[next] = potential[current] - potential[next] + cost + additional;
                            queue.push(KeyValue{key: min_cost[next], value: next});
                            prev[next] = pair;
                        }
                    }
                }
            }
            if min_cost[drain] != std::i32::MAX {
                let mut last = drain;
                while last != source {
                    let e = nodes[last][prev[last]];
                    nodes[last][prev[last]].flow += 1;
                    nodes[e.to][e.pair].flow -= 1;
                    last = nodes[last][prev[last]].to;
                }
                for i in 0 .. source {
                    if min_cost[i] != std::i32::MAX {
                        potential[i] += min_cost[i];
                    }
                }
                score += 100 - min_cost[drain];
            }else {
                break
            }
        }
        score
    }
    fn attack(attacker: &Vec<ByDol>, defender: &Vec<ByDol>, walls: &Vec<Wall>) -> i32 {
        let score = calculate_score(attacker, defender, walls);
        let mut shoot_count = Vec::with_capacity(attacker.len());
        for a in attacker {
            shoot_count.push(a.bullet.count as i32)
        }
        max_cost_matching(&shoot_count, &score)
    }
    fn main() {
        let_all!(n: usize, m: usize, o: usize);
        let mut white = Vec::with_capacity(n);
        let mut red = Vec::with_capacity(m);
        for _ in 0 .. n {
            let_all!(ax: f64, ay: f64, ap: f64, aq: usize, ar: usize, ascore: i32);
            white.push(ByDol{position: Point{x: ax, y: ay}, bullet: Bullet{bullet_type: if ar == 0 {BulletType::Normal} else {BulletType::Reflective}, length: ap, count: aq}, score: ascore});
        }
        for _ in 0 .. m {
            let_all!(bx: f64, by: f64, bp: f64, bq: usize, br: usize, bs: i32);
            red.push(ByDol{position: Point{x: bx, y: by}, bullet: Bullet{bullet_type: if br == 0{BulletType::Normal} else {BulletType::Reflective}, length: bp, count: bq}, score: bs});
        }
        let mut walls = Vec::with_capacity(o);
        for _ in 0 .. o {
            let_all!(wx: f64, wy: f64, wr: f64);
            walls.push(Wall{position: Point{x: wx, y: wy}, size: wr});
        }
        let white_score = attack(&white, &red, &walls);
        let red_score = attack(&red, &white, &walls);
        println!("{} {}", white_score, red_score);
        if white_score > red_score {
            println!("win");
        }else if white_score < red_score {
            println!("lose");
        }else {
            println!("draw");
        }
    }


Measured memory_bytes: 5076