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

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

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

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

k = A("k")
h = B("h")
i = C("i")
a = D("a")

k.q = h
k.x = h
k.o = i
k.t = i
h.v = k
h.p = i
i.u = a
a.t = i
assert a.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: B = None
        self.o: C = None
        self.t: C = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
i = C("i")
a = D("a")

k.q = h
k.x = h
k.o = i
k.t = i
h.v = k
h.p = i
i.u = a
a.t = i
assert a.t.u.t.txt == "i"