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

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

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

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

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

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

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

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

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

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

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

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

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

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

f.w = g
f.z = h
f.p = h
f.q = n
f.r = c
g.x = c
d.v = f
d.y = n
d.x = h
n.r = f
n.p = c
n.w = c
n.s = g
h.y = d
h.q = f
h.o = g
h.r = n
h.p = c
c.s = d
assert c.s.y.p.s.v.txt == "f"