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

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

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

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

d = A("d")
b = B("b")
k = C("k")
i = D("i")
e = A("e")

d.s = k
d.v = b
b.x = e
b.t = e
b.y = e
b.w = i
k.u = e
i.q = b
e.s = k
e.v = b
assert e.s.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: B = None
        self.txt = txt

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

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

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

d = A("d")
b = B("b")
k = C("k")
i = D("i")
e = A("e")

d.s = k
d.v = b
b.x = e
b.t = e
b.y = e
b.w = i
k.u = e
i.q = b
e.s = k
e.v = b
assert e.s.u.s.u.txt == "e"