class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: E = None
        self.o: F = None
        self.x: C = None
        self.s: G = None
        self.z: F = None
        self.v: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: B = None
        self.p: G = None
        self.s: C = None
        self.o: C = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: B = None
        self.p: G = None
        self.s: C = None
        self.o: C = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: B = None
        self.txt = txt

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

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