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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.y: C = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: E = None
        self.y: C = None
        self.s: A = None
        self.txt = txt

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

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