class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: D = None
        self.t: D = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

n.p = j
n.x = j
n.q = j
m.v = n
g.w = j
g.o = j
g.v = j
g.r = n
c.t = m
j.o = c
j.r = c
j.t = c
j.z = g
j.q = m
assert g.v.z.r.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: D = None
        self.t: D = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

n.p = j
n.x = j
n.q = j
m.v = n
g.w = j
g.o = j
g.v = j
g.r = n
c.t = m
j.o = c
j.r = c
j.t = c
j.z = g
j.q = m
assert g.v.z.r.x.q.txt == "m"