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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.y: G = None
        self.w: H = None
        self.p: H = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.y: G = None
        self.w: H = None
        self.p: H = None
        self.txt = txt

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

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

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

h.x = k
c.t = i
c.w = j
k.s = d
g.y = h
g.r = h
g.w = c
g.q = c
i.s = j
i.u = d
i.z = d
i.v = g
i.x = l
l.u = d
l.w = d
l.p = d
l.y = j
j.r = k
j.q = c
j.u = d
j.y = l
d.r = i
d.u = i
assert d.r.v.w.w.r.s.r.txt == "i"