class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.t: D = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.u: F = None
        self.x: G = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: E = None
        self.x: A = None
        self.y: A = None
        self.p: E = None
        self.w: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.t: D = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.u: F = None
        self.x: G = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: E = None
        self.x: A = None
        self.y: A = None
        self.p: E = None
        self.w: C = None
        self.txt = txt

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

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