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

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

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

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

j = A("j")
g = B("g")
d = C("d")
b = D("b")
l = A("l")
m = D("m")
i = A("i")
k = B("k")

j.t = g
j.v = g
j.o = l
j.z = d
g.y = k
g.z = m
g.s = l
d.y = m
d.p = l
d.q = k
d.t = k
b.s = l
b.z = m
l.t = g
l.v = g
l.o = j
l.z = d
m.s = i
m.z = b
i.t = k
i.o = j
i.v = g
i.z = d
k.y = g
k.z = m
k.s = i
assert l.z.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: A = None
        self.v: B = None
        self.z: C = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
d = C("d")
b = D("b")
l = A("l")
m = D("m")
i = A("i")
k = B("k")

j.t = g
j.v = g
j.o = l
j.z = d
g.y = k
g.z = m
g.s = l
d.y = m
d.p = l
d.q = k
d.t = k
b.s = l
b.z = m
l.t = g
l.v = g
l.o = j
l.z = d
m.s = i
m.z = b
i.t = k
i.o = j
i.v = g
i.z = d
k.y = g
k.z = m
k.s = i
assert l.z.t.s.txt == "i"