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

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

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

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

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

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

j.u = b
n.z = a
n.v = b
n.q = j
n.p = j
n.w = c
b.o = c
c.q = b
c.v = b
a.y = c
a.t = j
assert j.u.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

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

j.u = b
n.z = a
n.v = b
n.q = j
n.p = j
n.w = c
b.o = c
c.q = b
c.v = b
a.y = c
a.t = j
assert j.u.o.v.o.txt == "c"