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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l = A("l")
e = B("e")
m = C("m")
c = D("c")
i = E("i")
b = D("b")

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: D = None
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

l = A("l")
e = B("e")
m = C("m")
c = D("c")
i = E("i")
b = D("b")

l.x = b
l.y = c
l.w = m
e.z = b
e.o = b
m.y = c
m.p = l
m.r = e
c.q = m
c.r = m
c.p = m
c.t = b
i.z = e
b.q = m
b.r = m
b.p = m
b.t = c
assert l.x.r.y.txt == "c"