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

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

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

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

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

i.q = m
i.r = m
i.w = e
i.y = n
k.r = l
k.s = f
k.q = f
k.v = e
b.v = m
b.s = m
b.x = k
f.u = n
n.u = f
m.q = i
m.r = h
m.w = k
m.y = n
e.r = b
e.s = n
e.q = n
e.v = k
h.q = i
h.r = m
h.w = k
h.y = f
l.v = h
l.s = h
l.x = k
assert f.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.w: B = None
        self.y: D = None
        self.txt = txt

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

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

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

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

i.q = m
i.r = m
i.w = e
i.y = n
k.r = l
k.s = f
k.q = f
k.v = e
b.v = m
b.s = m
b.x = k
f.u = n
n.u = f
m.q = i
m.r = h
m.w = k
m.y = n
e.r = b
e.s = n
e.q = n
e.v = k
h.q = i
h.r = m
h.w = k
h.y = f
l.v = h
l.s = h
l.x = k
assert f.u.u.u.u.u.u.u.txt == "n"