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

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

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

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

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

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

d = A("d")
h = B("h")
m = C("m")
l = D("l")
j = E("j")
f = F("f")
g = E("g")
e = A("e")

d.p = g
d.y = h
d.r = l
h.s = m
h.y = l
h.w = d
h.z = f
m.o = l
m.w = j
l.x = h
l.u = d
l.y = d
l.v = j
l.o = j
j.w = m
j.v = m
j.p = m
j.t = f
f.w = h
g.w = m
g.v = m
g.p = m
g.t = f
e.p = j
e.y = h
e.r = l
assert g.t.w.z.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

d = A("d")
h = B("h")
m = C("m")
l = D("l")
j = E("j")
f = F("f")
g = E("g")
e = A("e")

d.p = g
d.y = h
d.r = l
h.s = m
h.y = l
h.w = d
h.z = f
m.o = l
m.w = j
l.x = h
l.u = d
l.y = d
l.v = j
l.o = j
j.w = m
j.v = m
j.p = m
j.t = f
f.w = h
g.w = m
g.v = m
g.p = m
g.t = f
e.p = j
e.y = h
e.r = l
assert g.t.w.z.w.s.w.txt == "j"