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

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

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

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

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

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

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

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

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

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

j.u = g
j.w = n
j.x = e
n.y = e
n.o = l
n.z = g
i.o = g
i.w = j
i.q = b
a.x = j
a.v = c
l.o = g
l.w = g
l.q = i
c.x = j
c.v = a
e.x = j
e.v = c
b.o = g
b.w = g
b.q = l
g.u = j
g.w = n
g.x = c
assert g.x.v.x.w.o.w.txt == "g"