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

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

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

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

g = A("g")
h = B("h")
k = C("k")
i = D("i")
c = A("c")
j = B("j")
f = C("f")
e = A("e")

g.z = j
g.s = f
g.o = c
g.x = c
h.y = j
h.u = j
k.y = c
i.y = c
c.z = j
c.s = k
c.o = g
c.x = e
j.y = h
j.u = h
f.y = g
e.z = h
e.s = f
e.o = c
e.x = c
assert i.y.s.y.x.z.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.o: A = None
        self.x: A = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
k = C("k")
i = D("i")
c = A("c")
j = B("j")
f = C("f")
e = A("e")

g.z = j
g.s = f
g.o = c
g.x = c
h.y = j
h.u = j
k.y = c
i.y = c
c.z = j
c.s = k
c.o = g
c.x = e
j.y = h
j.u = h
f.y = g
e.z = h
e.s = f
e.o = c
e.x = c
assert i.y.s.y.x.z.u.y.txt == "h"