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

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

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

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

h = A("h")
k = B("k")
f = C("f")
m = D("m")
l = A("l")
j = D("j")
i = A("i")
g = A("g")

h.u = f
h.t = f
h.x = k
h.z = j
k.u = l
f.z = g
f.u = k
f.p = k
f.t = k
m.o = g
m.x = j
m.t = j
m.q = l
l.u = f
l.t = f
l.x = k
l.z = j
j.o = g
j.q = g
j.x = m
j.t = m
i.u = f
i.t = f
i.x = k
i.z = j
g.u = f
g.t = f
g.x = k
g.z = j
assert h.z.x.o.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: B = None
        self.t: C = None
        self.z: D = None
        self.txt = txt

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

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

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

h = A("h")
k = B("k")
f = C("f")
m = D("m")
l = A("l")
j = D("j")
i = A("i")
g = A("g")

h.u = f
h.t = f
h.x = k
h.z = j
k.u = l
f.z = g
f.u = k
f.p = k
f.t = k
m.o = g
m.x = j
m.t = j
m.q = l
l.u = f
l.t = f
l.x = k
l.z = j
j.o = g
j.q = g
j.x = m
j.t = m
i.u = f
i.t = f
i.x = k
i.z = j
g.u = f
g.t = f
g.x = k
g.z = j
assert h.z.x.o.t.z.txt == "g"