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

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

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

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

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

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

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

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

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

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

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

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

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