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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.t: B = None
        self.txt = txt

a = A("a")
l = B("l")
b = C("b")
n = D("n")
i = E("i")
g = E("g")

a.v = l
a.q = l
l.p = a
l.o = a
b.z = a
n.w = b
n.r = b
n.t = l
i.z = l
i.x = l
i.t = l
g.z = l
g.x = l
g.t = l
assert b.z.q.p.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.t: B = None
        self.txt = txt

a = A("a")
l = B("l")
b = C("b")
n = D("n")
i = E("i")
g = E("g")

a.v = l
a.q = l
l.p = a
l.o = a
b.z = a
n.w = b
n.r = b
n.t = l
i.z = l
i.x = l
i.t = l
g.z = l
g.x = l
g.t = l
assert b.z.q.p.v.o.txt == "a"