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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

e.o = l
e.z = d
e.w = d
b.r = d
b.o = d
b.y = c
i.y = e
i.p = c
i.q = l
d.q = k
d.s = j
d.o = e
d.r = f
j.o = c
j.z = d
j.w = d
f.r = d
f.o = d
f.y = k
l.y = a
l.p = i
l.q = i
c.y = e
c.p = k
c.q = k
a.o = l
a.z = d
a.w = d
k.y = j
k.p = l
k.q = c
assert l.y.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

e.o = l
e.z = d
e.w = d
b.r = d
b.o = d
b.y = c
i.y = e
i.p = c
i.q = l
d.q = k
d.s = j
d.o = e
d.r = f
j.o = c
j.z = d
j.w = d
f.r = d
f.o = d
f.y = k
l.y = a
l.p = i
l.q = i
c.y = e
c.p = k
c.q = k
a.o = l
a.z = d
a.w = d
k.y = j
k.p = l
k.q = c
assert l.y.z.s.z.txt == "d"