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

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

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

c = A("c")
b = B("b")
k = C("k")
f = A("f")
j = B("j")
h = B("h")
g = C("g")

c.v = g
c.o = h
c.s = f
b.x = h
b.u = h
k.o = f
k.u = g
f.v = g
f.o = h
f.s = c
j.x = h
j.u = h
h.x = b
h.u = b
g.o = c
g.u = k
assert g.u.o.o.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.s: A = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
k = C("k")
f = A("f")
j = B("j")
h = B("h")
g = C("g")

c.v = g
c.o = h
c.s = f
b.x = h
b.u = h
k.o = f
k.u = g
f.v = g
f.o = h
f.s = c
j.x = h
j.u = h
h.x = b
h.u = b
g.o = c
g.u = k
assert g.u.o.o.x.u.x.txt == "b"