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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.p: H = None
        self.q: A = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.p: H = None
        self.q: A = None
        self.v: D = None
        self.txt = txt

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

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

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