class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: H = None
        self.z: F = None
        self.s: F = None
        self.t: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: G = None
        self.w: E = None
        self.txt = txt

d = A("d")
k = B("k")
g = C("g")
e = D("e")
h = E("h")
a = F("a")
i = G("i")
l = H("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: H = None
        self.z: F = None
        self.s: F = None
        self.t: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: G = None
        self.w: E = None
        self.txt = txt

d = A("d")
k = B("k")
g = C("g")
e = D("e")
h = E("h")
a = F("a")
i = G("i")
l = H("l")

d.x = g
d.y = e
k.x = e
g.u = d
g.t = e
e.z = i
e.y = k
e.u = a
h.v = k
h.u = l
h.t = l
h.z = a
h.s = a
a.o = g
a.z = k
a.v = h
a.t = i
i.r = g
i.q = a
l.q = i
l.r = i
l.w = h
assert l.w.v.x.y.x.z.q.v.txt == "h"