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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: A = None
        self.r: A = None
        self.q: D = None
        self.y: D = None
        self.u: G = None
        self.t: D = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: E = None
        self.z: F = None
        self.v: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: C = None
        self.p: E = None
        self.v: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: A = None
        self.r: A = None
        self.q: D = None
        self.y: D = None
        self.u: G = None
        self.t: D = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: E = None
        self.z: F = None
        self.v: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: C = None
        self.p: E = None
        self.v: C = None
        self.txt = txt

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

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