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

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

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

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

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

l = A("l")
d = B("d")
a = C("a")
j = D("j")
m = E("m")
b = D("b")

l.z = m
d.s = a
d.p = b
d.y = b
d.t = b
a.q = l
a.x = l
a.r = l
a.y = m
a.o = d
j.v = d
m.y = d
b.v = d
assert l.z.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

l = A("l")
d = B("d")
a = C("a")
j = D("j")
m = E("m")
b = D("b")

l.z = m
d.s = a
d.p = b
d.y = b
d.t = b
a.q = l
a.x = l
a.r = l
a.y = m
a.o = d
j.v = d
m.y = d
b.v = d
assert l.z.y.s.txt == "a"