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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: D = None
        self.t: A = None
        self.z: B = None
        self.s: A = None
        self.txt = txt

k = A("k")
m = B("m")
g = C("g")
n = D("n")
j = E("j")
i = F("i")
c = D("c")
a = E("a")
h = B("h")
b = D("b")

k.t = g
m.t = k
g.t = b
g.o = j
n.w = k
j.s = h
i.w = a
i.u = b
i.t = k
i.s = k
i.z = h
c.w = k
a.s = h
h.t = k
b.w = k
assert k.t.t.w.t.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: D = None
        self.t: A = None
        self.z: B = None
        self.s: A = None
        self.txt = txt

k = A("k")
m = B("m")
g = C("g")
n = D("n")
j = E("j")
i = F("i")
c = D("c")
a = E("a")
h = B("h")
b = D("b")

k.t = g
m.t = k
g.t = b
g.o = j
n.w = k
j.s = h
i.w = a
i.u = b
i.t = k
i.s = k
i.z = h
c.w = k
a.s = h
h.t = k
b.w = k
assert k.t.t.w.t.t.w.t.txt == "g"