class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: C = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: D = None
        self.s: D = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

j = A("j")
m = B("m")
b = C("b")
e = D("e")
l = E("l")
h = D("h")

j.q = m
j.s = b
j.o = b
m.p = j
b.z = m
b.v = m
b.p = h
b.s = h
e.v = b
e.y = j
e.r = h
l.t = j
l.z = m
h.v = b
h.y = j
h.r = e
assert e.v.s.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: C = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: D = None
        self.s: D = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

j = A("j")
m = B("m")
b = C("b")
e = D("e")
l = E("l")
h = D("h")

j.q = m
j.s = b
j.o = b
m.p = j
b.z = m
b.v = m
b.p = h
b.s = h
e.v = b
e.y = j
e.r = h
l.t = j
l.z = m
h.v = b
h.y = j
h.r = e
assert e.v.s.r.v.txt == "b"