class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.y: D = None
        self.z: F = None
        self.s: H = None
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: H = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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