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

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

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

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

e = A("e")
j = B("j")
a = C("a")
d = D("d")
h = A("h")
g = A("g")
b = A("b")
n = D("n")

e.s = j
e.y = j
e.z = n
e.o = d
j.v = a
a.z = j
a.s = j
d.o = b
h.s = j
h.y = j
h.z = n
h.o = n
g.s = j
g.y = j
g.z = d
g.o = n
b.s = j
b.y = j
b.z = n
b.o = n
n.o = e
assert d.o.o.o.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: D = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
a = C("a")
d = D("d")
h = A("h")
g = A("g")
b = A("b")
n = D("n")

e.s = j
e.y = j
e.z = n
e.o = d
j.v = a
a.z = j
a.s = j
d.o = b
h.s = j
h.y = j
h.z = n
h.o = n
g.s = j
g.y = j
g.z = d
g.o = n
b.s = j
b.y = j
b.z = n
b.o = n
n.o = e
assert d.o.o.o.y.v.txt == "a"