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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: H = None
        self.r: A = None
        self.q: E = None
        self.w: G = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: E = None
        self.txt = txt

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

a.t = h
a.q = m
a.p = b
a.z = b
a.u = n
a.w = i
n.x = i
n.v = i
b.y = h
b.q = h
b.o = i
b.r = a
b.s = a
b.w = g
k.q = n
k.p = n
h.x = m
m.v = k
m.r = b
g.z = m
g.u = m
g.q = k
i.p = k
i.u = h
assert i.u.x.v.q.v.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.p: C = None
        self.u: B = None
        self.z: C = None
        self.w: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: H = None
        self.r: A = None
        self.q: E = None
        self.w: G = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: E = None
        self.txt = txt

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

a.t = h
a.q = m
a.p = b
a.z = b
a.u = n
a.w = i
n.x = i
n.v = i
b.y = h
b.q = h
b.o = i
b.r = a
b.s = a
b.w = g
k.q = n
k.p = n
h.x = m
m.v = k
m.r = b
g.z = m
g.u = m
g.q = k
i.p = k
i.u = h
assert i.u.x.v.q.v.u.x.txt == "m"