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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.w: E = None
        self.t: F = None
        self.v: E = None
        self.s: G = None
        self.y: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: H = None
        self.x: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

j = A("j")
k = B("k")
l = C("l")
h = D("h")
d = E("d")
a = F("a")
n = G("n")
m = H("m")
f = B("f")

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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.w: E = None
        self.t: F = None
        self.v: E = None
        self.s: G = None
        self.y: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: H = None
        self.x: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

j = A("j")
k = B("k")
l = C("l")
h = D("h")
d = E("d")
a = F("a")
n = G("n")
m = H("m")
f = B("f")

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