class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.p: B = None
        self.v: D = None
        self.u: H = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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