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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.v: F = None
        self.u: C = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: A = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.v: F = None
        self.u: C = None
        self.x: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: A = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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