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

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

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

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

e = A("e")
a = B("a")
k = C("k")
i = D("i")
j = C("j")

e.q = a
a.v = i
a.o = j
a.s = j
k.u = a
i.s = a
i.t = e
j.u = a
assert i.t.q.s.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

e = A("e")
a = B("a")
k = C("k")
i = D("i")
j = C("j")

e.q = a
a.v = i
a.o = j
a.s = j
k.u = a
i.s = a
i.t = e
j.u = a
assert i.t.q.s.u.v.txt == "i"