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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: G = None
        self.x: F = None
        self.y: C = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.x: F = None
        self.o: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: G = None
        self.x: F = None
        self.y: C = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.x: F = None
        self.o: A = None
        self.txt = txt

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

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

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