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

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

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

d = A("d")
n = B("n")
l = C("l")
b = A("b")

d.o = b
d.y = b
d.t = l
n.u = l
l.v = d
b.o = d
b.y = d
b.t = l
assert d.y.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

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

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

d = A("d")
n = B("n")
l = C("l")
b = A("b")

d.o = b
d.y = b
d.t = l
n.u = l
l.v = d
b.o = d
b.y = d
b.t = l
assert d.y.t.v.txt == "d"