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

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

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

c = A("c")
d = B("d")
f = C("f")
e = B("e")
k = A("k")
b = A("b")
n = A("n")
a = A("a")

c.s = e
c.r = e
c.z = k
d.y = c
d.t = f
f.v = e
f.u = k
e.y = c
e.t = f
k.s = d
k.r = d
k.z = a
b.s = d
b.z = c
b.r = e
n.s = e
n.r = e
n.z = c
a.s = d
a.z = n
a.r = e
assert k.r.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
f = C("f")
e = B("e")
k = A("k")
b = A("b")
n = A("n")
a = A("a")

c.s = e
c.r = e
c.z = k
d.y = c
d.t = f
f.v = e
f.u = k
e.y = c
e.t = f
k.s = d
k.r = d
k.z = a
b.s = d
b.z = c
b.r = e
n.s = e
n.r = e
n.z = c
a.s = d
a.z = n
a.r = e
assert k.r.y.r.txt == "e"