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

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

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

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

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

n = A("n")
h = B("h")
m = C("m")
l = D("l")
d = E("d")
f = A("f")
j = B("j")
b = E("b")

n.x = l
n.t = b
n.u = f
n.q = f
n.w = d
h.w = j
m.r = n
l.s = j
d.r = b
f.x = l
f.t = d
f.u = n
f.q = n
f.w = b
j.w = h
b.r = d
assert b.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: E = None
        self.u: A = None
        self.q: A = None
        self.w: E = None
        self.txt = txt

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

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

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

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

n = A("n")
h = B("h")
m = C("m")
l = D("l")
d = E("d")
f = A("f")
j = B("j")
b = E("b")

n.x = l
n.t = b
n.u = f
n.q = f
n.w = d
h.w = j
m.r = n
l.s = j
d.r = b
f.x = l
f.t = d
f.u = n
f.q = n
f.w = b
j.w = h
b.r = d
assert b.r.r.r.r.txt == "b"