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

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

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

i = A("i")
k = B("k")
g = C("g")
e = C("e")
c = A("c")
h = C("h")

i.v = k
i.r = k
i.z = h
k.r = e
g.s = h
e.s = g
c.v = k
c.r = k
c.z = e
h.s = g
assert c.r.r.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
g = C("g")
e = C("e")
c = A("c")
h = C("h")

i.v = k
i.r = k
i.z = h
k.r = e
g.s = h
e.s = g
c.v = k
c.r = k
c.z = e
h.s = g
assert c.r.r.s.s.s.txt == "g"