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

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

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

l = A("l")
a = B("a")
n = C("n")
h = B("h")

l.x = a
l.v = n
a.o = h
a.u = n
a.x = n
n.x = l
n.u = a
n.r = h
h.o = a
h.u = n
h.x = n
assert a.x.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
n = C("n")
h = B("h")

l.x = a
l.v = n
a.o = h
a.u = n
a.x = n
n.x = l
n.u = a
n.r = h
h.o = a
h.u = n
h.x = n
assert a.x.u.o.txt == "h"