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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.z: B = None
        self.o: D = None
        self.r: B = None
        self.u: A = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: G = None
        self.p: B = None
        self.w: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.v: B = None
        self.s: D = None
        self.x: E = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

m = A("m")
b = B("b")
g = C("g")
c = D("c")
j = E("j")
i = F("i")
k = G("k")
a = H("a")

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.z: B = None
        self.o: D = None
        self.r: B = None
        self.u: A = None
        self.p: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: G = None
        self.p: B = None
        self.w: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.v: B = None
        self.s: D = None
        self.x: E = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

m = A("m")
b = B("b")
g = C("g")
c = D("c")
j = E("j")
i = F("i")
k = G("k")
a = H("a")

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