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

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

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

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

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

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

j.u = n
j.y = b
j.r = a
b.s = h
b.w = d
b.z = f
b.u = a
f.t = b
f.v = h
f.s = n
f.r = j
d.q = a
d.w = j
n.s = f
h.q = j
h.w = a
c.t = b
c.v = h
c.s = n
c.r = j
a.u = n
a.y = b
a.r = j
assert b.w.w.r.y.z.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: B = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

j.u = n
j.y = b
j.r = a
b.s = h
b.w = d
b.z = f
b.u = a
f.t = b
f.v = h
f.s = n
f.r = j
d.q = a
d.w = j
n.s = f
h.q = j
h.w = a
c.t = b
c.v = h
c.s = n
c.r = j
a.u = n
a.y = b
a.r = j
assert b.w.w.r.y.z.s.s.txt == "f"