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

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

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

h = A("h")
m = B("m")
k = C("k")
d = B("d")
n = C("n")

h.x = m
h.o = d
h.u = d
m.y = h
k.y = n
k.s = d
d.y = h
n.y = k
n.s = d
assert m.y.u.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
k = C("k")
d = B("d")
n = C("n")

h.x = m
h.o = d
h.u = d
m.y = h
k.y = n
k.s = d
d.y = h
n.y = k
n.s = d
assert m.y.u.y.o.txt == "d"