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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.q: G = None
        self.t: F = None
        self.v: H = None
        self.u: C = None
        self.z: H = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.q: G = None
        self.t: F = None
        self.v: H = None
        self.u: C = None
        self.z: H = None
        self.s: C = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: E = None
        self.q: D = None
        self.txt = txt

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

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

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

h.q = c
c.p = m
c.v = m
c.z = m
c.q = k
c.t = n
c.u = l
c.s = l
c.r = l
l.u = h
l.s = b
l.q = n
l.r = d
b.w = h
d.o = n
d.p = n
d.y = l
d.x = l
n.x = l
n.u = d
n.q = b
k.o = c
k.x = n
m.x = h
assert h.q.t.u.txt == "d"