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

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

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

g = A("g")
h = B("h")
a = C("a")
j = A("j")
m = B("m")
k = B("k")
e = C("e")
d = C("d")

g.u = j
g.t = j
h.v = k
h.x = k
h.w = d
a.v = h
j.u = g
j.t = g
m.v = h
m.w = e
m.x = k
k.v = m
k.x = m
k.w = e
e.v = m
d.v = k
assert m.v.w.v.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.txt = txt

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

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

g = A("g")
h = B("h")
a = C("a")
j = A("j")
m = B("m")
k = B("k")
e = C("e")
d = C("d")

g.u = j
g.t = j
h.v = k
h.x = k
h.w = d
a.v = h
j.u = g
j.t = g
m.v = h
m.w = e
m.x = k
k.v = m
k.x = m
k.w = e
e.v = m
d.v = k
assert m.v.w.v.v.x.txt == "k"