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

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

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

b = A("b")
e = B("e")
f = C("f")
k = B("k")
i = A("i")
j = A("j")
h = C("h")

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

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

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

b = A("b")
e = B("e")
f = C("f")
k = B("k")
i = A("i")
j = A("j")
h = C("h")

b.u = e
b.v = h
e.v = k
f.s = j
f.o = j
f.v = i
k.v = e
i.u = e
i.v = f
j.u = e
j.v = h
h.s = b
h.v = i
h.o = j
assert i.u.v.v.txt == "e"