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

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

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

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

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

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

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

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

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

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

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

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

b.p = j
b.v = i
c.w = n
i.q = l
i.t = c
l.t = b
j.r = n
j.q = n
j.u = c
j.z = c
j.t = l
n.p = j
n.v = i
assert j.t.t.p.q.v.t.txt == "c"