class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

j.o = l
j.u = l
j.t = g
m.w = j
m.t = e
m.p = g
l.r = m
g.z = e
g.x = e
g.t = b
g.w = m
e.x = g
b.w = j
b.t = e
b.p = g
assert l.r.t.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

j.o = l
j.u = l
j.t = g
m.w = j
m.t = e
m.p = g
l.r = m
g.z = e
g.x = e
g.t = b
g.w = m
e.x = g
b.w = j
b.t = e
b.p = g
assert l.r.t.x.z.x.txt == "g"