class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: C = None
        self.t: B = None
        self.w: B = None
        self.u: E = None
        self.v: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

d = A("d")
c = B("c")
f = C("f")
n = D("n")
h = E("h")
b = F("b")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

d = A("d")
c = B("c")
f = C("f")
n = D("n")
h = E("h")
b = F("b")

d.s = c
d.t = c
d.w = c
d.p = f
d.u = h
d.v = h
c.p = n
f.v = b
f.w = d
f.o = d
f.z = n
n.x = b
n.s = c
h.o = b
h.y = d
h.p = f
b.q = f
assert c.p.s.p.s.p.txt == "n"