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

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

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

g = A("g")
b = B("b")
d = C("d")
h = A("h")
k = C("k")
e = A("e")
f = A("f")
i = B("i")

g.z = k
g.u = k
g.y = b
b.t = h
b.r = e
b.v = d
d.s = g
d.w = g
h.z = d
h.u = d
h.y = b
k.s = h
k.w = f
e.z = k
e.u = k
e.y = b
f.z = k
f.y = b
f.u = d
i.t = g
i.r = g
i.v = k
assert d.s.y.r.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: B = None
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
b = B("b")
d = C("d")
h = A("h")
k = C("k")
e = A("e")
f = A("f")
i = B("i")

g.z = k
g.u = k
g.y = b
b.t = h
b.r = e
b.v = d
d.s = g
d.w = g
h.z = d
h.u = d
h.y = b
k.s = h
k.w = f
e.z = k
e.u = k
e.y = b
f.z = k
f.y = b
f.u = d
i.t = g
i.r = g
i.v = k
assert d.s.y.r.u.s.txt == "h"