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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

n.u = e
n.y = e
n.q = l
n.t = f
m.w = b
g.u = l
e.o = j
e.v = k
e.w = k
i.w = b
f.u = e
f.y = e
f.q = g
f.t = n
j.u = e
j.y = e
j.q = g
j.t = n
l.u = g
k.u = g
b.w = m
assert f.q.u.u.u.u.u.txt == "l"