#[allow(unused_macros, dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros, dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros, dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
struct UnionFind {
    parent: Vec<usize>,
    rank: Vec<usize>,
    size: Vec<usize>,
}

#[allow(dead_code)]
impl UnionFind {
    fn new(n: usize) -> UnionFind {
        let mut p = vec![0; n];
        for i in 0..n {
            p[i] = i;
        }
        return UnionFind {
            parent: p,
            rank: vec![0; n],
            size: vec![1; n],
        };
    }

    fn find(&mut self, x: usize) -> usize {
        if x == self.parent[x] {
            x
        } else {
            let p = self.parent[x];
            let pr = self.find(p);
            self.parent[x] = pr;
            pr
        }
    }

    fn same(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }

    fn unite(&mut self, a: usize, b: usize) {
        let a_root = self.find(a);
        let b_root = self.find(b);
        if self.rank[a_root] > self.rank[b_root] {
            self.parent[b_root] = a_root;
            self.size[a_root] += self.size[b_root];
        } else {
            self.parent[a_root] = b_root;
            self.size[b_root] += self.size[a_root];
            if self.rank[a_root] == self.rank[b_root] {
                self.rank[b_root] += 1;
            }
        }
    }

    fn get_size(&mut self, x: usize) -> usize {
        let root = self.find(x);
        self.size[root]
    }
}

const MOD_P: usize = 1000000007;

#[allow(dead_code)]
// fact(n) = n! mod p
fn fact(n: usize) -> usize {
    let mut acc = 1;
    for i in 1..n + 1 {
        acc = acc * i % MOD_P;
    }
    acc
}

#[allow(dead_code)]
fn mod_pow(b: usize, mut e: usize) -> usize {
    let mut base = b;
    let mut acc = 1;

    while e > 1 {
        if e % 2 == 1 {
            acc = acc * base % MOD_P;
        }
        e /= 2;
        base = base * base % MOD_P;
    }

    if e == 1 {
        acc = acc * base % MOD_P;
    }

    acc
}

#[allow(dead_code)]
fn comb(n: usize, r: usize) -> usize {
    // nCr = n! / (r! (n-r)!) = n! (r!)^(p-2) ((n-r)!)^(p-2)
    fact(n) * mod_pow(fact(r), MOD_P - 2) % MOD_P * mod_pow(fact(n - r), MOD_P - 2) % MOD_P
}

#[allow(dead_code)]
fn getline() -> String {
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

#[derive(Debug, Clone, Copy)]
struct Dice {
    face: [usize; 6],
}

impl Dice {
    pub fn new(v: Vec<usize>) -> Dice {
        Dice {
            face: [v[0], v[1], v[2], v[3], v[4], v[5]],
        }
    }
    pub fn get_top(&self) -> usize {
        self.face[0]
    }
    pub fn get_front(&self) -> usize {
        self.face[1]
    }
    pub fn get_right(&self) -> usize {
        self.face[2]
    }

    fn roll(&mut self, i: usize, j: usize, k: usize, l: usize) {
        let (a, b, c, d) = (self.face[i], self.face[j], self.face[k], self.face[l]);
        self.face[i] = b;
        self.face[j] = c;
        self.face[k] = d;
        self.face[l] = a;
    }

    pub fn roll_to_north(&mut self) {
        self.roll(0, 1, 5, 4);
    }
    pub fn roll_to_south(&mut self) {
        self.roll(4, 5, 1, 0);
    }
    pub fn roll_to_east(&mut self) {
        self.roll(0, 3, 5, 2);
    }
    pub fn roll_to_west(&mut self) {
        self.roll(0, 2, 5, 3);
    }
    pub fn roll_to_left(&mut self) {
        self.roll(1, 2, 4, 3);
    }
    pub fn roll_to_right(&mut self) {
        self.roll(3, 4, 2, 1);
    }
    pub fn reachable_by_rolling_to_north(&self, i: usize) -> bool {
        return self.face[0] == i || self.face[1] == i || self.face[5] == i || self.face[4] == i;
    }

    pub fn eq(&mut self, other: &Dice) -> bool {
        (0..6).fold(true, |acc, i| acc && self.face[i] == other.face[i])
    }

    pub fn equal_to(&mut self, other: &Dice) -> bool {
        let d = self.clone();
        let mut ds = [d.clone(); 6];
        ds[1].roll_to_north();
        ds[2].roll_to_south();
        ds[3].roll_to_north();
        ds[3].roll_to_north();
        ds[4].roll_to_east();
        ds[5].roll_to_west();

        for d in ds.iter_mut() {
            for _ in 0..5 {
                if d.eq(other) {
                    return true;
                }
                d.roll_to_right();
            }
        }
        return false;
    }
}

fn main() {
    input! {
        m: [usize; 6],
        n: [usize; 6],
    }

    let mut d1 = Dice::new(m);
    let d2 = Dice::new(n);
    println!("{}", if d1.equal_to(&d2) { "Yes" } else { "No" });
}



Measured memory_bytes: 5028