class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: F = None
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: E = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: D = None
        self.txt = txt

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

j = A("j")
e = B("e")
m = C("m")
n = D("n")
k = E("k")
f = F("f")

j.w = k
j.s = k
j.q = f
e.z = n
m.o = f
m.u = f
m.p = k
n.r = e
n.s = e
n.x = m
n.p = j
n.q = k
n.z = k
k.y = n
k.t = n
f.o = e
assert f.o.z.p.q.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: F = None
        self.s: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: E = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: D = None
        self.txt = txt

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

j = A("j")
e = B("e")
m = C("m")
n = D("n")
k = E("k")
f = F("f")

j.w = k
j.s = k
j.q = f
e.z = n
m.o = f
m.u = f
m.p = k
n.r = e
n.s = e
n.x = m
n.p = j
n.q = k
n.z = k
k.y = n
k.t = n
f.o = e
assert f.o.z.p.q.o.z.txt == "n"