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

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

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

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

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

c.o = m
c.s = k
c.v = g
c.q = g
k.w = g
n.r = m
n.t = m
i.w = k
m.r = n
m.t = g
g.r = n
g.t = n
j.o = n
j.s = k
j.v = m
j.q = g
e.w = k
assert g.r.t.t.r.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: B = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

c.o = m
c.s = k
c.v = g
c.q = g
k.w = g
n.r = m
n.t = m
i.w = k
m.r = n
m.t = g
g.r = n
g.t = n
j.o = n
j.s = k
j.v = m
j.q = g
e.w = k
assert g.r.t.t.r.t.t.t.txt == "n"