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

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

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

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

e = A("e")
i = B("i")
c = C("c")
b = D("b")

e.y = i
i.v = b
i.q = e
c.u = i
b.y = i
b.s = i
assert i.q.y.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

e = A("e")
i = B("i")
c = C("c")
b = D("b")

e.y = i
i.v = b
i.q = e
c.u = i
b.y = i
b.s = i
assert i.q.y.v.s.txt == "i"