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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: A = None
        self.r: A = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: H = None
        self.q: H = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
e = D("e")
k = E("k")
h = F("h")
c = G("c")
m = H("m")
n = C("n")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: A = None
        self.r: A = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: H = None
        self.q: H = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
e = D("e")
k = E("k")
h = F("h")
c = G("c")
m = H("m")
n = C("n")

g.q = k
d.y = g
d.o = g
f.r = n
f.q = m
f.x = m
f.p = h
f.u = h
f.y = c
f.o = k
e.p = k
e.w = k
e.q = d
e.x = m
k.q = d
k.p = d
k.u = g
k.r = g
k.x = g
h.z = d
h.x = m
h.q = m
h.s = c
c.t = e
c.w = f
m.s = f
n.r = f
n.q = m
n.x = m
n.p = h
n.u = h
n.y = c
n.o = k
assert k.u.q.r.q.txt == "k"