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

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

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

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

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

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

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

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

e.s = h
e.z = b
i.x = e
i.s = g
i.v = b
k.z = c
k.w = c
k.s = i
g.s = e
g.z = b
b.x = h
b.s = h
b.v = i
c.z = k
c.w = k
c.s = b
h.s = g
h.z = b
assert i.s.z.s.s.s.z.txt == "b"