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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

l.p = j
c.u = l
c.s = n
j.t = k
j.x = c
j.y = n
n.v = c
n.s = c
n.p = c
n.x = j
n.z = l
k.v = l
k.q = l
k.w = j
k.u = j
k.r = c
assert j.t.r.s.p.txt == "c"