class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: B = None
        self.r: C = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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