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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: A = None
        self.p: G = None
        self.y: G = None
        self.z: D = None
        self.x: D = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.p: C = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: D = None
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: G = None
        self.z: E = None
        self.p: G = None
        self.r: B = None
        self.t: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

a = A("a")
j = B("j")
f = C("f")
h = D("h")
m = E("m")
c = F("c")
i = G("i")

a.t = m
j.t = a
j.u = c
j.z = c
f.q = i
f.p = i
f.y = i
f.o = a
f.z = h
f.x = h
f.t = m
h.w = j
h.u = j
h.s = f
h.p = f
m.x = f
m.z = f
m.o = h
c.w = a
c.t = a
c.x = i
c.p = i
c.z = m
c.r = j
i.s = m
assert a.t.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: A = None
        self.p: G = None
        self.y: G = None
        self.z: D = None
        self.x: D = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.p: C = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: D = None
        self.z: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: G = None
        self.z: E = None
        self.p: G = None
        self.r: B = None
        self.t: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

a = A("a")
j = B("j")
f = C("f")
h = D("h")
m = E("m")
c = F("c")
i = G("i")

a.t = m
j.t = a
j.u = c
j.z = c
f.q = i
f.p = i
f.y = i
f.o = a
f.z = h
f.x = h
f.t = m
h.w = j
h.u = j
h.s = f
h.p = f
m.x = f
m.z = f
m.o = h
c.w = a
c.t = a
c.x = i
c.p = i
c.z = m
c.r = j
i.s = m
assert a.t.x.z.txt == "h"