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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: A = None
        self.q: G = None
        self.v: E = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: G = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

g = A("g")
j = B("j")
d = C("d")
m = D("m")
b = E("b")
e = F("e")
h = G("h")
i = H("i")

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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: A = None
        self.q: G = None
        self.v: E = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: G = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

g = A("g")
j = B("j")
d = C("d")
m = D("m")
b = E("b")
e = F("e")
h = G("h")
i = H("i")

g.r = i
j.r = d
j.q = i
d.u = b
d.v = b
d.o = g
d.q = h
m.u = e
m.z = e
b.p = h
e.x = h
e.t = h
e.r = j
e.o = j
e.z = d
h.s = d
h.u = d
h.y = j
h.w = e
h.p = i
i.t = b
i.s = h
i.v = g
i.o = g
assert m.z.x.s.q.w.t.txt == "h"