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

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

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

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

k = A("k")
c = B("c")
m = C("m")
j = D("j")
e = B("e")
d = C("d")
h = B("h")
f = D("f")
a = A("a")
l = D("l")

k.s = l
k.y = h
k.u = m
k.x = j
c.z = d
m.v = l
j.x = k
j.s = f
j.o = h
e.z = d
d.v = f
h.z = d
f.x = a
f.s = l
f.o = c
a.s = j
a.y = c
a.u = d
a.x = l
l.x = a
l.s = j
l.o = c
assert h.z.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: B = None
        self.u: C = None
        self.x: D = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
m = C("m")
j = D("j")
e = B("e")
d = C("d")
h = B("h")
f = D("f")
a = A("a")
l = D("l")

k.s = l
k.y = h
k.u = m
k.x = j
c.z = d
m.v = l
j.x = k
j.s = f
j.o = h
e.z = d
d.v = f
h.z = d
f.x = a
f.s = l
f.o = c
a.s = j
a.y = c
a.u = d
a.x = l
l.x = a
l.s = j
l.o = c
assert h.z.v.o.z.txt == "d"