class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: E = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: C = None
        self.p: F = None
        self.y: D = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
m = C("m")
k = D("k")
h = E("h")
g = F("g")
a = C("a")

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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: C = None
        self.p: F = None
        self.y: D = None
        self.txt = txt

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

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

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

n = A("n")
b = B("b")
m = C("m")
k = D("k")
h = E("h")
g = F("g")
a = C("a")

n.s = g
n.z = g
n.q = h
b.y = m
b.s = g
m.r = g
m.p = g
m.x = a
m.y = k
k.v = n
h.u = b
h.z = g
h.t = g
h.y = n
h.r = k
g.y = m
g.o = b
a.r = g
a.p = g
a.x = m
a.y = k
assert g.o.y.x.x.y.txt == "k"