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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: G = None
        self.v: D = None
        self.z: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: B = None
        self.o: B = None
        self.p: B = None
        self.t: B = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: D = None
        self.w: B = None
        self.o: F = None
        self.s: B = None
        self.t: F = None
        self.txt = txt

n = A("n")
m = B("m")
f = C("f")
j = D("j")
d = E("d")
e = F("e")
l = G("l")

n.t = m
n.z = l
m.t = n
m.z = j
f.o = e
f.r = l
f.v = j
f.z = m
j.q = n
j.z = e
j.y = l
d.p = j
d.u = j
e.r = l
e.s = m
e.o = m
e.p = m
e.t = m
e.w = f
l.q = m
l.w = m
l.s = m
l.v = j
l.o = e
l.t = e
assert m.z.q.z.v.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: G = None
        self.v: D = None
        self.z: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: B = None
        self.o: B = None
        self.p: B = None
        self.t: B = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: D = None
        self.w: B = None
        self.o: F = None
        self.s: B = None
        self.t: F = None
        self.txt = txt

n = A("n")
m = B("m")
f = C("f")
j = D("j")
d = E("d")
e = F("e")
l = G("l")

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