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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.q: C = None
        self.v: D = None
        self.x: B = None
        self.u: B = None
        self.txt = txt

a = A("a")
j = B("j")
h = C("h")
b = D("b")
n = E("n")
m = F("m")
k = C("k")
g = D("g")

a.z = n
j.o = a
j.t = m
h.p = a
h.r = a
h.q = k
h.t = k
h.w = g
b.p = a
b.t = k
n.z = h
n.t = m
m.t = a
m.r = j
m.x = j
m.u = j
m.q = k
m.v = b
k.p = a
k.r = a
k.q = h
k.t = h
k.w = g
g.p = a
g.t = h
assert a.z.t.q.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.q: C = None
        self.v: D = None
        self.x: B = None
        self.u: B = None
        self.txt = txt

a = A("a")
j = B("j")
h = C("h")
b = D("b")
n = E("n")
m = F("m")
k = C("k")
g = D("g")

a.z = n
j.o = a
j.t = m
h.p = a
h.r = a
h.q = k
h.t = k
h.w = g
b.p = a
b.t = k
n.z = h
n.t = m
m.t = a
m.r = j
m.x = j
m.u = j
m.q = k
m.v = b
k.p = a
k.r = a
k.q = h
k.t = h
k.w = g
g.p = a
g.t = h
assert a.z.t.q.w.t.txt == "h"