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

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

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

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

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

l = A("l")
e = B("e")
j = C("j")
f = D("f")
n = E("n")

l.z = f
l.r = j
e.q = j
j.y = n
j.q = f
j.w = f
j.r = l
f.p = n
n.s = f
n.o = l
n.t = j
assert j.r.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

l = A("l")
e = B("e")
j = C("j")
f = D("f")
n = E("n")

l.z = f
l.r = j
e.q = j
j.y = n
j.q = f
j.w = f
j.r = l
f.p = n
n.s = f
n.o = l
n.t = j
assert j.r.r.y.txt == "n"