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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: C = None
        self.q: H = None
        self.r: H = None
        self.x: H = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: C = None
        self.t: B = None
        self.o: B = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: G = None
        self.v: C = None
        self.y: H = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: B = None
        self.u: F = None
        self.q: D = None
        self.txt = txt

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

m.r = d
d.q = g
d.u = a
d.w = c
c.q = m
c.w = d
g.u = k
g.w = c
g.q = e
g.r = e
g.x = e
g.p = e
a.v = c
a.x = c
a.p = c
a.t = d
a.o = d
i.q = c
i.v = c
i.r = k
i.y = e
i.o = a
i.p = g
k.u = g
k.p = m
k.x = d
e.y = k
e.p = d
e.u = i
e.q = g
assert k.x.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: C = None
        self.q: H = None
        self.r: H = None
        self.x: H = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: C = None
        self.t: B = None
        self.o: B = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: G = None
        self.v: C = None
        self.y: H = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: B = None
        self.u: F = None
        self.q: D = None
        self.txt = txt

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

m.r = d
d.q = g
d.u = a
d.w = c
c.q = m
c.w = d
g.u = k
g.w = c
g.q = e
g.r = e
g.x = e
g.p = e
a.v = c
a.x = c
a.p = c
a.t = d
a.o = d
i.q = c
i.v = c
i.r = k
i.y = e
i.o = a
i.p = g
k.u = g
k.p = m
k.x = d
e.y = k
e.p = d
e.u = i
e.q = g
assert k.x.q.w.q.txt == "m"