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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.w: C = None
        self.txt = txt

l = A("l")
a = B("a")
e = C("e")
b = D("b")
i = E("i")

l.q = i
l.p = i
a.p = b
a.t = l
e.z = l
b.q = i
b.o = i
i.x = e
i.w = e
i.y = l
assert b.o.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.w: C = None
        self.txt = txt

l = A("l")
a = B("a")
e = C("e")
b = D("b")
i = E("i")

l.q = i
l.p = i
a.p = b
a.t = l
e.z = l
b.q = i
b.o = i
i.x = e
i.w = e
i.y = l
assert b.o.y.p.txt == "i"