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

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

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

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

k = A("k")
a = B("a")
f = C("f")
e = D("e")
n = A("n")

k.y = f
k.t = f
a.s = e
a.y = n
f.x = e
e.v = f
e.q = k
n.y = f
n.t = f
assert f.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

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

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

k = A("k")
a = B("a")
f = C("f")
e = D("e")
n = A("n")

k.y = f
k.t = f
a.s = e
a.y = n
f.x = e
e.v = f
e.q = k
n.y = f
n.t = f
assert f.x.v.x.txt == "e"