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

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

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

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

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

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

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

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

d.y = g
d.s = c
d.z = h
f.z = g
a.o = e
a.r = h
a.x = f
g.z = f
h.o = e
h.r = a
h.x = g
e.o = h
e.r = k
e.x = f
b.z = f
c.y = g
c.s = d
c.z = a
k.o = h
k.r = h
k.x = g
assert c.s.s.z.o.r.x.z.z.txt == "g"