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

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

c = A("c")
d = B("d")
k = A("k")
b = A("b")
l = B("l")
i = B("i")

c.x = k
d.v = k
d.o = l
k.x = c
b.x = k
l.v = b
l.o = i
i.v = k
i.o = l
assert d.o.o.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

c = A("c")
d = B("d")
k = A("k")
b = A("b")
l = B("l")
i = B("i")

c.x = k
d.v = k
d.o = l
k.x = c
b.x = k
l.v = b
l.o = i
i.v = k
i.o = l
assert d.o.o.v.x.x.txt == "k"