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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: G = None
        self.t: D = None
        self.y: G = None
        self.u: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: F = None
        self.r: B = None
        self.v: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: H = None
        self.q: C = None
        self.u: D = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: C = None
        self.z: F = None
        self.y: D = None
        self.w: A = None
        self.q: D = None
        self.u: F = None
        self.t: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: G = None
        self.t: D = None
        self.y: G = None
        self.u: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: F = None
        self.r: B = None
        self.v: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: H = None
        self.q: C = None
        self.u: D = None
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: C = None
        self.z: F = None
        self.y: D = None
        self.w: A = None
        self.q: D = None
        self.u: F = None
        self.t: D = None
        self.txt = txt

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

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