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

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

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

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

m = A("m")
l = B("l")
i = C("i")
b = D("b")

m.v = i
m.y = l
m.t = l
l.o = i
l.q = i
l.t = m
i.y = m
i.v = m
i.o = b
b.s = i
b.v = l
assert i.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
i = C("i")
b = D("b")

m.v = i
m.y = l
m.t = l
l.o = i
l.q = i
l.t = m
i.y = m
i.v = m
i.o = b
b.s = i
b.v = l
assert i.o.s.o.txt == "b"