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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.q: A = None
        self.r: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.w: D = None
        self.v: B = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.q: A = None
        self.r: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.w: D = None
        self.v: B = None
        self.txt = txt

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

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

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

a.v = c
c.t = a
c.q = a
c.r = a
c.u = l
c.p = b
l.o = b
l.w = b
l.q = c
l.v = c
b.r = c
b.v = c
b.p = n
n.x = l
assert l.v.p.v.txt == "c"