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

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

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

c = A("c")
i = B("i")
a = C("a")
f = B("f")
b = A("b")
k = A("k")
g = C("g")

c.v = i
c.y = a
c.o = b
i.o = k
i.u = b
i.v = g
a.o = g
a.v = g
a.z = b
f.o = c
f.u = c
f.v = g
b.v = f
b.y = a
b.o = c
k.v = i
k.y = a
k.o = b
g.o = a
g.v = a
g.z = c
assert k.v.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.o: A = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
a = C("a")
f = B("f")
b = A("b")
k = A("k")
g = C("g")

c.v = i
c.y = a
c.o = b
i.o = k
i.u = b
i.v = g
a.o = g
a.v = g
a.z = b
f.o = c
f.u = c
f.v = g
b.v = f
b.y = a
b.o = c
k.v = i
k.y = a
k.o = b
g.o = a
g.v = a
g.z = c
assert k.v.v.o.z.txt == "b"