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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.z: B = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: C = None
        self.txt = txt

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

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

a.y = g
a.s = g
j.u = e
j.y = m
j.z = h
j.v = l
i.w = c
i.v = c
e.o = m
g.y = a
g.s = a
m.u = n
m.y = h
m.z = j
m.v = c
n.o = j
c.w = i
c.v = l
h.u = e
h.y = m
h.z = m
h.v = i
l.w = i
l.v = c
assert m.z.z.v.w.v.v.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: B = None
        self.z: B = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: C = None
        self.txt = txt

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

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

a.y = g
a.s = g
j.u = e
j.y = m
j.z = h
j.v = l
i.w = c
i.v = c
e.o = m
g.y = a
g.s = a
m.u = n
m.y = h
m.z = j
m.v = c
n.o = j
c.w = i
c.v = l
h.u = e
h.y = m
h.z = m
h.v = i
l.w = i
l.v = c
assert m.z.z.v.w.v.v.v.w.txt == "i"