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

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

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

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

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

g = A("g")
l = B("l")
b = C("b")
f = D("f")
n = E("n")
h = C("h")
e = C("e")

g.r = n
l.r = f
l.y = f
l.w = e
l.x = e
l.q = n
b.v = f
b.u = f
f.w = g
f.x = g
n.r = h
h.v = f
h.u = f
e.v = f
e.u = f
assert n.r.u.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

g = A("g")
l = B("l")
b = C("b")
f = D("f")
n = E("n")
h = C("h")
e = C("e")

g.r = n
l.r = f
l.y = f
l.w = e
l.x = e
l.q = n
b.v = f
b.u = f
f.w = g
f.x = g
n.r = h
h.v = f
h.u = f
e.v = f
e.u = f
assert n.r.u.w.r.txt == "n"