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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

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

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

m.q = g
m.u = c
f.v = c
n.y = m
n.q = m
n.w = g
k.w = g
k.y = f
k.s = j
k.q = i
j.q = m
j.u = c
c.y = j
c.w = m
c.q = m
g.q = j
g.u = l
i.w = j
i.y = f
i.s = m
i.q = k
l.y = g
l.w = m
l.q = j
e.w = m
e.y = f
e.s = g
e.q = k
assert j.q.q.u.y.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

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

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

m.q = g
m.u = c
f.v = c
n.y = m
n.q = m
n.w = g
k.w = g
k.y = f
k.s = j
k.q = i
j.q = m
j.u = c
c.y = j
c.w = m
c.q = m
g.q = j
g.u = l
i.w = j
i.y = f
i.s = m
i.q = k
l.y = g
l.w = m
l.q = j
e.w = m
e.y = f
e.s = g
e.q = k
assert j.q.q.u.y.u.q.txt == "j"