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

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

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

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

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

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

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

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

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

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

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

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

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

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

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