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

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

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

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

c = A("c")
g = B("g")
d = C("d")
k = D("k")
h = A("h")
e = D("e")
l = B("l")

c.z = g
c.s = d
c.v = d
c.w = h
g.z = d
g.x = l
g.y = k
d.z = l
k.u = d
k.w = h
h.z = g
h.s = d
h.v = d
h.w = c
e.u = d
e.w = h
l.z = d
l.x = g
l.y = k
assert k.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
d = C("d")
k = D("k")
h = A("h")
e = D("e")
l = B("l")

c.z = g
c.s = d
c.v = d
c.w = h
g.z = d
g.x = l
g.y = k
d.z = l
k.u = d
k.w = h
h.z = g
h.s = d
h.v = d
h.w = c
e.u = d
e.w = h
l.z = d
l.x = g
l.y = k
assert k.u.z.z.txt == "d"