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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: E = None
        self.q: C = None
        self.y: E = None
        self.txt = txt

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

l = A("l")
i = B("i")
g = C("g")
k = D("k")
d = E("d")

l.z = d
i.t = g
g.v = d
k.u = i
k.s = d
k.y = d
k.q = g
d.z = g
d.w = g
d.y = l
d.v = l
assert d.z.v.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: E = None
        self.q: C = None
        self.y: E = None
        self.txt = txt

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

l = A("l")
i = B("i")
g = C("g")
k = D("k")
d = E("d")

l.z = d
i.t = g
g.v = d
k.u = i
k.s = d
k.y = d
k.q = g
d.z = g
d.w = g
d.y = l
d.v = l
assert d.z.v.y.z.txt == "d"