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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: A = None
        self.t: B = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

m.q = a
m.z = d
m.p = k
g.v = d
g.z = n
c.y = n
j.o = d
j.q = m
j.t = g
j.x = a
n.s = m
n.q = c
a.t = d
d.y = n
k.x = m
k.v = a
assert n.q.y.s.p.x.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: G = None
        self.p: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: A = None
        self.t: B = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

m.q = a
m.z = d
m.p = k
g.v = d
g.z = n
c.y = n
j.o = d
j.q = m
j.t = g
j.x = a
n.s = m
n.q = c
a.t = d
d.y = n
k.x = m
k.v = a
assert n.q.y.s.p.x.p.v.txt == "a"