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

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

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

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

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

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

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

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

g.y = b
a.o = g
a.x = g
a.u = f
f.z = b
f.v = g
f.t = i
b.o = g
b.x = g
b.u = f
i.z = a
i.v = g
i.t = f
assert b.x.y.x.y.u.txt == "f"