class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: C = None
        self.z: A = None
        self.y: D = None
        self.txt = txt

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

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

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

e = A("e")
g = B("g")
l = C("l")
h = D("h")
m = C("m")
k = A("k")
j = B("j")
d = B("d")
f = D("f")
n = A("n")

e.r = d
e.v = l
e.z = k
e.y = f
g.y = e
g.p = d
g.x = k
g.u = l
l.q = m
l.v = m
h.o = f
m.q = l
m.v = l
k.r = j
k.v = l
k.z = n
k.y = h
j.y = k
j.p = d
j.x = n
j.u = l
d.y = e
d.x = e
d.p = g
d.u = l
f.o = h
n.r = d
n.v = l
n.z = k
n.y = f
assert j.u.v.v.q.v.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: C = None
        self.z: A = None
        self.y: D = None
        self.txt = txt

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

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

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

e = A("e")
g = B("g")
l = C("l")
h = D("h")
m = C("m")
k = A("k")
j = B("j")
d = B("d")
f = D("f")
n = A("n")

e.r = d
e.v = l
e.z = k
e.y = f
g.y = e
g.p = d
g.x = k
g.u = l
l.q = m
l.v = m
h.o = f
m.q = l
m.v = l
k.r = j
k.v = l
k.z = n
k.y = h
j.y = k
j.p = d
j.x = n
j.u = l
d.y = e
d.x = e
d.p = g
d.u = l
f.o = h
n.r = d
n.v = l
n.z = k
n.y = f
assert j.u.v.v.q.v.q.q.txt == "l"