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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: G = None
        self.v: E = None
        self.z: A = None
        self.x: F = None
        self.s: H = None
        self.y: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: F = None
        self.t: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.r: G = None
        self.x: B = None
        self.p: E = None
        self.z: D = None
        self.v: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: D = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
g = D("g")
d = E("d")
m = F("m")
e = G("e")
n = H("n")

f.r = d
f.t = d
f.p = n
k.u = a
k.o = e
k.v = d
k.z = f
k.x = m
k.y = m
k.s = n
a.s = f
g.w = f
g.v = m
g.t = k
d.p = e
d.o = g
d.s = k
m.t = k
m.s = k
m.x = k
m.r = e
m.v = e
m.p = d
m.z = g
e.w = d
n.v = d
n.t = g
assert m.r.w.o.v.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: E = None
        self.p: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: G = None
        self.v: E = None
        self.z: A = None
        self.x: F = None
        self.s: H = None
        self.y: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: F = None
        self.t: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.r: G = None
        self.x: B = None
        self.p: E = None
        self.z: D = None
        self.v: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: D = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
g = D("g")
d = E("d")
m = F("m")
e = G("e")
n = H("n")

f.r = d
f.t = d
f.p = n
k.u = a
k.o = e
k.v = d
k.z = f
k.x = m
k.y = m
k.s = n
a.s = f
g.w = f
g.v = m
g.t = k
d.p = e
d.o = g
d.s = k
m.t = k
m.s = k
m.x = k
m.r = e
m.v = e
m.p = d
m.z = g
e.w = d
n.v = d
n.t = g
assert m.r.w.o.v.v.w.txt == "d"