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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

a.p = h
a.u = h
a.o = h
a.w = g
h.v = d
h.w = d
h.p = d
e.s = a
e.t = a
e.v = g
g.p = h
g.y = h
g.s = d
g.w = e
g.u = k
d.v = g
d.p = e
k.r = g
assert a.w.s.p.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: B = None
        self.w: D = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

a.p = h
a.u = h
a.o = h
a.w = g
h.v = d
h.w = d
h.p = d
e.s = a
e.t = a
e.v = g
g.p = h
g.y = h
g.s = d
g.w = e
g.u = k
d.v = g
d.p = e
k.r = g
assert a.w.s.p.t.w.txt == "g"