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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: D = None
        self.v: E = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

l = A("l")
c = B("c")
m = C("m")
n = D("n")
g = E("g")

l.z = m
l.q = c
c.y = m
c.p = n
c.v = g
c.x = l
c.r = l
m.y = c
n.z = c
g.q = m
g.v = m
assert n.z.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: D = None
        self.v: E = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

l = A("l")
c = B("c")
m = C("m")
n = D("n")
g = E("g")

l.z = m
l.q = c
c.y = m
c.p = n
c.v = g
c.x = l
c.r = l
m.y = c
n.z = c
g.q = m
g.v = m
assert n.z.r.q.p.txt == "n"