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

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

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

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

l = A("l")
a = B("a")
e = C("e")
m = D("m")
j = C("j")
g = C("g")
f = B("f")

l.w = j
a.q = l
a.z = f
e.s = f
e.p = m
e.z = m
e.o = a
m.v = j
m.p = j
m.z = g
m.w = l
j.s = a
j.p = m
j.z = m
j.o = f
g.s = f
g.p = m
g.z = m
g.o = a
f.q = l
f.z = a
assert a.z.z.z.q.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

l = A("l")
a = B("a")
e = C("e")
m = D("m")
j = C("j")
g = C("g")
f = B("f")

l.w = j
a.q = l
a.z = f
e.s = f
e.p = m
e.z = m
e.o = a
m.v = j
m.p = j
m.z = g
m.w = l
j.s = a
j.p = m
j.z = m
j.o = f
g.s = f
g.p = m
g.z = m
g.o = a
f.q = l
f.z = a
assert a.z.z.z.q.w.o.q.txt == "l"