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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

b = A("b")
i = B("i")
k = C("k")
a = D("a")
c = C("c")
f = D("f")
d = A("d")

b.x = a
b.t = i
i.s = f
i.v = a
k.v = d
a.s = c
a.p = c
a.r = d
c.v = b
f.s = k
f.r = b
f.p = c
d.x = a
d.t = i
assert c.v.x.r.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

b = A("b")
i = B("i")
k = C("k")
a = D("a")
c = C("c")
f = D("f")
d = A("d")

b.x = a
b.t = i
i.s = f
i.v = a
k.v = d
a.s = c
a.p = c
a.r = d
c.v = b
f.s = k
f.r = b
f.p = c
d.x = a
d.t = i
assert c.v.x.r.t.s.txt == "f"