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

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

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

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

d = A("d")
m = B("m")
c = C("c")
f = D("f")
l = A("l")
n = A("n")
k = D("k")
e = D("e")
b = D("b")

d.x = m
d.q = m
d.o = c
d.z = c
m.y = k
m.p = b
m.z = c
c.s = m
f.p = c
f.x = c
f.z = m
l.x = m
l.q = m
l.o = c
l.z = c
n.x = m
n.q = m
n.o = c
n.z = c
k.p = c
k.x = c
k.z = m
e.p = c
e.x = c
e.z = m
b.p = c
b.x = c
b.z = m
assert l.o.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

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

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

d = A("d")
m = B("m")
c = C("c")
f = D("f")
l = A("l")
n = A("n")
k = D("k")
e = D("e")
b = D("b")

d.x = m
d.q = m
d.o = c
d.z = c
m.y = k
m.p = b
m.z = c
c.s = m
f.p = c
f.x = c
f.z = m
l.x = m
l.q = m
l.o = c
l.z = c
n.x = m
n.q = m
n.o = c
n.z = c
k.p = c
k.x = c
k.z = m
e.p = c
e.x = c
e.z = m
b.p = c
b.x = c
b.z = m
assert l.o.s.z.txt == "c"