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

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

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

e = A("e")
m = B("m")
d = C("d")
l = A("l")
f = C("f")
b = B("b")
j = A("j")
c = A("c")
a = B("a")

e.v = b
e.q = m
m.p = d
m.s = e
d.v = a
d.u = a
d.s = f
l.v = m
l.q = m
f.v = a
f.s = d
f.u = b
b.p = d
b.s = c
j.v = m
j.q = b
c.v = a
c.q = m
a.p = f
a.s = c
assert j.v.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: B = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
d = C("d")
l = A("l")
f = C("f")
b = B("b")
j = A("j")
c = A("c")
a = B("a")

e.v = b
e.q = m
m.p = d
m.s = e
d.v = a
d.u = a
d.s = f
l.v = m
l.q = m
f.v = a
f.s = d
f.u = b
b.p = d
b.s = c
j.v = m
j.q = b
c.v = a
c.q = m
a.p = f
a.s = c
assert j.v.s.q.txt == "m"