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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: D = None
        self.z: A = None
        self.u: B = None
        self.txt = txt

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

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

j.v = k
l.r = n
l.s = n
g.r = j
c.x = n
c.y = i
c.z = k
c.u = l
n.s = j
n.x = j
i.x = n
i.y = c
i.z = j
i.u = l
h.r = n
h.s = n
k.v = j
assert l.s.x.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: D = None
        self.z: A = None
        self.u: B = None
        self.txt = txt

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

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

j.v = k
l.r = n
l.s = n
g.r = j
c.x = n
c.y = i
c.z = k
c.u = l
n.s = j
n.x = j
i.x = n
i.y = c
i.z = j
i.u = l
h.r = n
h.s = n
k.v = j
assert l.s.x.v.v.v.txt == "k"