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

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

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

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

e = A("e")
j = B("j")
c = C("c")
d = D("d")
g = D("g")
f = B("f")
i = D("i")
l = A("l")
b = A("b")

e.x = j
e.r = i
j.t = l
c.o = i
c.y = i
d.z = c
d.s = c
d.w = c
g.z = c
g.s = c
g.w = c
f.t = l
i.z = c
i.s = c
i.w = c
l.x = j
l.r = i
b.x = f
b.r = d
assert b.r.z.y.w.o.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
c = C("c")
d = D("d")
g = D("g")
f = B("f")
i = D("i")
l = A("l")
b = A("b")

e.x = j
e.r = i
j.t = l
c.o = i
c.y = i
d.z = c
d.s = c
d.w = c
g.z = c
g.s = c
g.w = c
f.t = l
i.z = c
i.s = c
i.w = c
l.x = j
l.r = i
b.x = f
b.r = d
assert b.r.z.y.w.o.z.y.z.txt == "c"