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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: G = None
        self.w: F = None
        self.y: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: C = None
        self.y: B = None
        self.txt = txt

n = A("n")
f = B("f")
b = C("b")
c = D("c")
j = E("j")
i = F("i")
m = G("m")
l = A("l")
g = F("g")
k = D("k")

n.y = f
f.t = m
b.z = m
c.t = n
c.x = j
j.s = c
j.o = m
j.w = i
j.y = b
i.s = b
i.x = g
m.u = j
m.x = b
m.y = f
l.y = f
g.s = b
g.x = i
k.t = l
k.x = j
assert k.t.y.t.u.s.x.y.z.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: G = None
        self.w: F = None
        self.y: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: C = None
        self.y: B = None
        self.txt = txt

n = A("n")
f = B("f")
b = C("b")
c = D("c")
j = E("j")
i = F("i")
m = G("m")
l = A("l")
g = F("g")
k = D("k")

n.y = f
f.t = m
b.z = m
c.t = n
c.x = j
j.s = c
j.o = m
j.w = i
j.y = b
i.s = b
i.x = g
m.u = j
m.x = b
m.y = f
l.y = f
g.s = b
g.x = i
k.t = l
k.x = j
assert k.t.y.t.u.s.x.y.z.x.z.txt == "m"