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

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

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

j = A("j")
l = B("l")
d = C("d")
e = C("e")
n = B("n")
h = B("h")
m = C("m")
c = C("c")

j.q = n
j.x = n
j.v = n
l.y = h
l.q = h
d.u = c
d.x = l
e.u = m
e.x = n
n.y = h
n.q = l
h.y = n
h.q = n
m.u = c
m.x = n
c.u = e
c.x = l
assert m.x.y.y.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: B = None
        self.v: B = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
d = C("d")
e = C("e")
n = B("n")
h = B("h")
m = C("m")
c = C("c")

j.q = n
j.x = n
j.v = n
l.y = h
l.q = h
d.u = c
d.x = l
e.u = m
e.x = n
n.y = h
n.q = l
h.y = n
h.q = n
m.u = c
m.x = n
c.u = e
c.x = l
assert m.x.y.y.y.q.txt == "n"