class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.u: A = 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.o: A = None
        self.txt = txt

d = A("d")
h = B("h")
k = C("k")
a = A("a")
l = B("l")

d.y = k
d.t = k
d.u = a
h.y = a
k.o = d
a.y = k
a.t = k
a.u = d
l.y = a
assert a.u.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.u: A = 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.o: A = None
        self.txt = txt

d = A("d")
h = B("h")
k = C("k")
a = A("a")
l = B("l")

d.y = k
d.t = k
d.u = a
h.y = a
k.o = d
a.y = k
a.t = k
a.u = d
l.y = a
assert a.u.y.o.y.txt == "k"