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

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

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

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

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

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

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

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

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

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

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

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

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