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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.t: A = None
        self.r: H = None
        self.o: C = None
        self.y: E = None
        self.w: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: A = None
        self.s: D = None
        self.p: F = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
c = C("c")
m = D("m")
g = E("g")
d = F("d")
h = G("h")
k = H("k")
n = F("n")
i = G("i")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.t: A = None
        self.r: H = None
        self.o: C = None
        self.y: E = None
        self.w: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: A = None
        self.s: D = None
        self.p: F = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
c = C("c")
m = D("m")
g = E("g")
d = F("d")
h = G("h")
k = H("k")
n = F("n")
i = G("i")

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