class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.x: H = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: G = None
        self.z: G = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.x: H = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: G = None
        self.z: G = None
        self.txt = txt

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

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