class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

j = A("j")
h = B("h")
e = C("e")
a = A("a")
i = B("i")
b = C("b")
l = A("l")

j.r = h
j.v = a
j.y = l
h.t = b
e.p = a
a.r = i
a.v = j
a.y = j
i.t = b
b.p = a
l.r = h
l.v = j
l.y = j
assert e.p.v.y.y.v.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

j = A("j")
h = B("h")
e = C("e")
a = A("a")
i = B("i")
b = C("b")
l = A("l")

j.r = h
j.v = a
j.y = l
h.t = b
e.p = a
a.r = i
a.v = j
a.y = j
i.t = b
b.p = a
l.r = h
l.v = j
l.y = j
assert e.p.v.y.y.v.r.t.txt == "b"