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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: D = None
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
i = C("i")
e = D("e")
b = E("b")
j = B("j")

f.w = i
h.p = j
h.s = f
h.q = f
h.r = e
i.z = e
i.p = e
i.y = f
i.u = b
e.s = i
e.y = j
b.x = i
b.s = e
b.v = e
j.p = h
j.s = f
j.q = f
j.r = e
assert f.w.y.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: D = None
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
i = C("i")
e = D("e")
b = E("b")
j = B("j")

f.w = i
h.p = j
h.s = f
h.q = f
h.r = e
i.z = e
i.p = e
i.y = f
i.u = b
e.s = i
e.y = j
b.x = i
b.s = e
b.v = e
j.p = h
j.s = f
j.q = f
j.r = e
assert f.w.y.w.u.txt == "b"