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

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

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

h = A("h")
a = B("a")
k = C("k")
m = C("m")
d = C("d")
g = A("g")
i = B("i")
f = B("f")
c = A("c")
n = B("n")

h.w = n
h.v = c
h.t = g
a.x = n
k.x = d
m.x = k
d.x = k
g.w = a
g.v = h
g.t = c
i.x = n
f.x = i
c.w = a
c.v = h
c.t = h
n.x = a
assert f.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
k = C("k")
m = C("m")
d = C("d")
g = A("g")
i = B("i")
f = B("f")
c = A("c")
n = B("n")

h.w = n
h.v = c
h.t = g
a.x = n
k.x = d
m.x = k
d.x = k
g.w = a
g.v = h
g.t = c
i.x = n
f.x = i
c.w = a
c.v = h
c.t = h
n.x = a
assert f.x.x.x.x.x.x.x.txt == "a"