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

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

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

c = A("c")
d = B("d")
l = C("l")
b = C("b")
k = A("k")
m = C("m")
h = A("h")
j = C("j")
f = B("f")

c.w = f
d.s = f
d.x = j
l.u = f
l.z = m
l.q = j
b.u = d
b.z = j
b.q = l
k.w = f
m.u = f
m.z = b
m.q = l
h.w = d
j.u = d
j.z = l
j.q = l
f.s = d
f.x = b
assert l.q.u.s.s.s.s.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
l = C("l")
b = C("b")
k = A("k")
m = C("m")
h = A("h")
j = C("j")
f = B("f")

c.w = f
d.s = f
d.x = j
l.u = f
l.z = m
l.q = j
b.u = d
b.z = j
b.q = l
k.w = f
m.u = f
m.z = b
m.q = l
h.w = d
j.u = d
j.z = l
j.q = l
f.s = d
f.x = b
assert l.q.u.s.s.s.s.x.z.z.txt == "m"