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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: F = None
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.txt = txt

j = A("j")
a = B("a")
l = C("l")
f = D("f")
i = E("i")
m = F("m")

j.q = f
j.p = l
j.r = a
a.q = m
a.u = m
a.s = i
a.o = i
l.w = a
l.z = i
f.s = j
i.z = l
m.t = j
m.u = l
assert a.s.z.z.z.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: C = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: F = None
        self.s: E = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.txt = txt

j = A("j")
a = B("a")
l = C("l")
f = D("f")
i = E("i")
m = F("m")

j.q = f
j.p = l
j.r = a
a.q = m
a.u = m
a.s = i
a.o = i
l.w = a
l.z = i
f.s = j
i.z = l
m.t = j
m.u = l
assert a.s.z.z.z.w.u.txt == "m"