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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

j = A("j")
a = B("a")
d = C("d")
c = D("c")
b = E("b")
f = A("f")
k = D("k")

j.s = d
j.y = d
j.r = d
j.w = c
a.w = k
a.y = b
a.r = b
a.s = b
a.p = d
d.p = k
d.q = j
c.w = b
c.s = b
c.t = d
b.q = a
f.s = d
f.y = d
f.r = d
f.w = c
k.w = b
k.s = b
k.t = d
assert f.y.q.r.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.w: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

j = A("j")
a = B("a")
d = C("d")
c = D("c")
b = E("b")
f = A("f")
k = D("k")

j.s = d
j.y = d
j.r = d
j.w = c
a.w = k
a.y = b
a.r = b
a.s = b
a.p = d
d.p = k
d.q = j
c.w = b
c.s = b
c.t = d
b.q = a
f.s = d
f.y = d
f.r = d
f.w = c
k.w = b
k.s = b
k.t = d
assert f.y.q.r.p.w.txt == "b"