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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

l.p = e
l.z = e
l.q = g
h.o = e
h.t = l
g.x = d
j.r = h
j.y = e
e.r = b
e.o = h
d.r = h
d.y = e
b.p = e
b.z = e
b.q = g
assert e.o.o.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: C = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

l.p = e
l.z = e
l.q = g
h.o = e
h.t = l
g.x = d
j.r = h
j.y = e
e.r = b
e.o = h
d.r = h
d.y = e
b.p = e
b.z = e
b.q = g
assert e.o.o.o.t.txt == "l"