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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: B = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

f = A("f")
k = B("k")
m = C("m")
g = D("g")
n = B("n")
l = C("l")
h = A("h")
b = B("b")
a = C("a")

f.s = g
f.z = l
k.u = f
k.t = g
k.r = m
k.x = n
m.s = k
m.v = k
m.t = l
g.x = m
g.q = b
g.t = b
g.r = n
n.u = f
n.t = g
n.r = a
n.x = k
l.s = n
l.t = a
l.v = b
h.s = g
h.z = l
b.u = f
b.t = g
b.r = m
b.x = k
a.s = n
a.t = m
a.v = k
assert k.u.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: B = None
        self.r: B = None
        self.t: B = None
        self.txt = txt

f = A("f")
k = B("k")
m = C("m")
g = D("g")
n = B("n")
l = C("l")
h = A("h")
b = B("b")
a = C("a")

f.s = g
f.z = l
k.u = f
k.t = g
k.r = m
k.x = n
m.s = k
m.v = k
m.t = l
g.x = m
g.q = b
g.t = b
g.r = n
n.u = f
n.t = g
n.r = a
n.x = k
l.s = n
l.t = a
l.v = b
h.s = g
h.z = l
b.u = f
b.t = g
b.r = m
b.x = k
a.s = n
a.t = m
a.v = k
assert k.u.z.t.txt == "a"