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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: E = None
        self.x: F = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: E = None
        self.x: F = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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