class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.o: F = None
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: G = None
        self.t: G = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
l = C("l")
m = D("m")
f = E("f")
b = F("b")
h = G("h")

n.u = m
n.r = f
n.o = b
n.p = b
k.z = l
k.q = f
k.p = m
l.u = k
l.s = f
l.x = f
m.p = n
m.v = b
f.o = k
f.s = k
f.q = h
f.t = h
f.w = l
b.t = f
h.s = m
h.x = m
h.t = b
h.r = k
h.v = k
assert n.u.v.t.t.x.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.o: F = None
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: G = None
        self.t: G = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
l = C("l")
m = D("m")
f = E("f")
b = F("b")
h = G("h")

n.u = m
n.r = f
n.o = b
n.p = b
k.z = l
k.q = f
k.p = m
l.u = k
l.s = f
l.x = f
m.p = n
m.v = b
f.o = k
f.s = k
f.q = h
f.t = h
f.w = l
b.t = f
h.s = m
h.x = m
h.t = b
h.r = k
h.v = k
assert n.u.v.t.t.x.p.p.txt == "b"