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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.x: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: B = None
        self.x: D = None
        self.o: F = None
        self.txt = txt

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

e = A("e")
l = B("l")
k = C("k")
g = D("g")
a = E("a")
j = F("j")
f = E("f")
n = D("n")

e.w = n
l.t = e
l.z = e
l.p = g
k.r = n
k.q = g
k.x = j
g.y = l
g.q = e
a.s = j
a.o = j
a.r = l
a.x = n
j.z = f
f.s = j
f.o = j
f.r = l
f.x = n
n.y = l
n.q = e
assert a.s.z.x.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.x: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: B = None
        self.x: D = None
        self.o: F = None
        self.txt = txt

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

e = A("e")
l = B("l")
k = C("k")
g = D("g")
a = E("a")
j = F("j")
f = E("f")
n = D("n")

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