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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

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

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

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