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

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

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

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

i = A("i")
e = B("e")
n = C("n")
g = D("g")

i.u = g
e.s = n
n.z = g
n.w = g
n.o = i
n.r = e
g.o = n
g.q = n
g.s = i
assert e.s.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
n = C("n")
g = D("g")

i.u = g
e.s = n
n.z = g
n.w = g
n.o = i
n.r = e
g.o = n
g.q = n
g.s = i
assert e.s.r.s.r.txt == "e"