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

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

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

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

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

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

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

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

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

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

e.w = a
e.p = a
e.t = k
a.p = e
k.x = i
k.q = i
i.r = k
i.o = e
assert e.t.x.r.q.txt == "i"