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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: C = None
        self.z: A = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: B = None
        self.x: A = None
        self.u: B = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: C = None
        self.p: F = None
        self.r: A = None
        self.s: B = None
        self.u: C = None
        self.w: B = None
        self.z: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: A = None
        self.y: E = None
        self.o: A = None
        self.p: B = None
        self.q: E = None
        self.txt = txt

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

a = A("a")
i = B("i")
d = C("d")
m = D("m")
k = E("k")
h = F("h")
l = G("l")
g = H("g")

a.r = k
a.v = h
i.u = m
i.p = d
i.z = a
i.o = k
d.w = g
d.v = i
d.u = i
d.x = a
d.t = a
m.y = l
m.o = d
m.u = d
m.p = h
m.r = a
m.s = i
m.w = i
m.z = g
k.o = d
h.r = d
l.v = h
l.r = a
l.o = a
l.y = k
l.q = k
l.p = i
g.u = d
assert k.o.w.u.t.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: C = None
        self.z: A = None
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.v: B = None
        self.x: A = None
        self.u: B = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.o: C = None
        self.p: F = None
        self.r: A = None
        self.s: B = None
        self.u: C = None
        self.w: B = None
        self.z: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: A = None
        self.y: E = None
        self.o: A = None
        self.p: B = None
        self.q: E = None
        self.txt = txt

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

a = A("a")
i = B("i")
d = C("d")
m = D("m")
k = E("k")
h = F("h")
l = G("l")
g = H("g")

a.r = k
a.v = h
i.u = m
i.p = d
i.z = a
i.o = k
d.w = g
d.v = i
d.u = i
d.x = a
d.t = a
m.y = l
m.o = d
m.u = d
m.p = h
m.r = a
m.s = i
m.w = i
m.z = g
k.o = d
h.r = d
l.v = h
l.r = a
l.o = a
l.y = k
l.q = k
l.p = i
g.u = d
assert k.o.w.u.t.r.o.txt == "d"