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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: A = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

e = A("e")
k = B("k")
n = C("n")
l = D("l")
g = E("g")
i = F("i")
f = F("f")
j = E("j")

e.t = j
k.w = g
k.y = n
n.z = k
l.u = g
l.t = e
l.w = n
g.q = e
g.v = e
g.x = k
g.y = n
i.t = f
f.t = i
j.q = e
j.v = e
j.x = k
j.y = n
assert l.w.z.y.z.y.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: A = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

e = A("e")
k = B("k")
n = C("n")
l = D("l")
g = E("g")
i = F("i")
f = F("f")
j = E("j")

e.t = j
k.w = g
k.y = n
n.z = k
l.u = g
l.t = e
l.w = n
g.q = e
g.v = e
g.x = k
g.y = n
i.t = f
f.t = i
j.q = e
j.v = e
j.x = k
j.y = n
assert l.w.z.y.z.y.z.w.txt == "g"