class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: E = None
        self.p: E = None
        self.t: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: G = None
        self.s: H = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = None
        self.s: H = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: G = None
        self.q: F = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

h.q = e
h.u = j
h.p = j
h.t = n
l.q = h
l.t = m
l.s = n
l.w = e
e.x = h
e.w = c
e.s = n
e.q = n
b.t = c
b.q = c
b.x = m
b.p = n
j.t = b
j.r = l
c.x = e
c.p = h
c.u = h
c.o = l
c.y = m
m.o = n
m.z = h
n.t = h
assert m.z.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: E = None
        self.p: E = None
        self.t: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: G = None
        self.s: H = None
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = None
        self.s: H = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: G = None
        self.q: F = None
        self.p: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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