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

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

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

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

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

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

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

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

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

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

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

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

f.q = a
f.w = a
f.s = k
f.t = k
b.p = j
b.q = j
b.o = j
b.w = f
a.v = k
j.s = b
j.t = k
k.x = b
k.q = f
k.y = j
d.p = j
d.q = j
d.o = j
d.w = f
assert j.s.q.s.w.txt == "f"