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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: G = None
        self.r: G = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: G = None
        self.r: G = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

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

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