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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
h = C("h")
k = D("k")
g = D("g")
l = D("l")
n = B("n")
c = B("c")
i = A("i")
a = D("a")

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
h = C("h")
k = D("k")
g = D("g")
l = D("l")
n = B("n")
c = B("c")
i = A("i")
a = D("a")

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