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

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

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

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.o: C = None
        self.y: G = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: G = None
        self.z: A = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: F = None
        self.v: E = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

n = A("n")
a = B("a")
d = C("d")
g = D("g")
m = E("m")
h = F("h")
i = G("i")
k = B("k")
f = A("f")
j = D("j")

n.u = h
a.w = i
d.v = g
d.r = a
g.t = i
g.y = i
g.o = d
g.p = n
m.x = d
m.r = n
h.t = k
h.u = i
h.y = i
h.z = f
i.r = j
i.u = h
i.v = m
i.y = m
i.t = k
k.w = i
f.u = h
j.t = i
j.y = i
j.o = d
j.p = n
assert f.u.z.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.o: C = None
        self.y: G = None
        self.p: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: G = None
        self.z: A = None
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: F = None
        self.v: E = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

n = A("n")
a = B("a")
d = C("d")
g = D("g")
m = E("m")
h = F("h")
i = G("i")
k = B("k")
f = A("f")
j = D("j")

n.u = h
a.w = i
d.v = g
d.r = a
g.t = i
g.y = i
g.o = d
g.p = n
m.x = d
m.r = n
h.t = k
h.u = i
h.y = i
h.z = f
i.r = j
i.u = h
i.v = m
i.y = m
i.t = k
k.w = i
f.u = h
j.t = i
j.y = i
j.o = d
j.p = n
assert f.u.z.u.z.u.txt == "h"