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

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

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

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

h = A("h")
c = B("c")
k = C("k")
f = D("f")
e = D("e")
a = C("a")

h.x = c
h.u = e
c.z = h
c.y = h
c.x = f
k.r = a
k.z = e
k.o = h
f.s = h
f.t = a
f.z = k
f.o = k
e.s = h
e.t = a
e.z = a
e.o = k
a.r = k
a.z = f
a.o = h
assert c.z.x.z.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: D = None
        self.txt = txt

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

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

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

h = A("h")
c = B("c")
k = C("k")
f = D("f")
e = D("e")
a = C("a")

h.x = c
h.u = e
c.z = h
c.y = h
c.x = f
k.r = a
k.z = e
k.o = h
f.s = h
f.t = a
f.z = k
f.o = k
e.s = h
e.t = a
e.z = a
e.o = k
a.r = k
a.z = f
a.o = h
assert c.z.x.z.u.s.txt == "h"