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

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

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

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

f = A("f")
k = B("k")
b = C("b")
i = D("i")
h = D("h")

f.z = k
f.q = i
f.t = h
k.s = h
b.t = f
b.v = k
i.u = f
i.t = k
i.s = k
i.v = h
h.u = f
h.t = k
h.s = k
h.v = i
assert k.s.v.t.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: D = None
        self.t: D = None
        self.txt = txt

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

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

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

f = A("f")
k = B("k")
b = C("b")
i = D("i")
h = D("h")

f.z = k
f.q = i
f.t = h
k.s = h
b.t = f
b.v = k
i.u = f
i.t = k
i.s = k
i.v = h
h.u = f
h.t = k
h.s = k
h.v = i
assert k.s.v.t.s.s.txt == "k"