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

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

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

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

j = A("j")
k = B("k")
e = C("e")
i = D("i")
a = A("a")
d = C("d")

j.o = i
j.z = d
j.r = d
k.y = e
k.v = a
k.o = d
k.u = j
e.y = i
e.w = i
e.x = d
i.u = a
i.y = k
a.o = i
a.z = e
a.r = e
d.y = i
d.w = i
d.x = e
assert j.r.x.w.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.r: C = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
e = C("e")
i = D("i")
a = A("a")
d = C("d")

j.o = i
j.z = d
j.r = d
k.y = e
k.v = a
k.o = d
k.u = j
e.y = i
e.w = i
e.x = d
i.u = a
i.y = k
a.o = i
a.z = e
a.r = e
d.y = i
d.w = i
d.x = e
assert j.r.x.w.y.v.txt == "a"