class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

d = A("d")
h = B("h")
e = C("e")
g = D("g")
a = E("a")
f = F("f")
b = F("b")

d.w = e
h.x = d
e.o = a
e.v = f
e.x = f
e.y = g
e.w = g
g.v = e
g.o = e
g.z = f
g.w = f
g.q = h
a.q = e
a.v = b
f.x = g
f.z = e
f.p = h
b.x = g
b.z = e
b.p = h
assert g.w.z.v.p.x.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

d = A("d")
h = B("h")
e = C("e")
g = D("g")
a = E("a")
f = F("f")
b = F("b")

d.w = e
h.x = d
e.o = a
e.v = f
e.x = f
e.y = g
e.w = g
g.v = e
g.o = e
g.z = f
g.w = f
g.q = h
a.q = e
a.v = b
f.x = g
f.z = e
f.p = h
b.x = g
b.z = e
b.p = h
assert g.w.z.v.p.x.w.o.txt == "a"