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

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

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

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

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

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

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

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

c.o = g
c.w = h
c.s = i
g.v = c
g.z = c
h.z = e
h.w = e
h.u = c
e.v = i
e.z = c
i.o = e
i.w = h
i.s = c
j.z = g
j.u = i
j.w = e
assert h.z.v.o.z.o.z.txt == "c"