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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: A = None
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
k = C("k")
c = D("c")
m = E("m")
n = C("n")
g = D("g")

l.x = b
l.w = g
b.u = n
k.u = l
k.x = l
k.p = n
c.o = m
c.u = k
c.r = l
m.t = l
n.u = l
n.x = l
n.p = k
g.o = m
g.u = n
g.r = l
assert n.p.u.w.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: A = None
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
k = C("k")
c = D("c")
m = E("m")
n = C("n")
g = D("g")

l.x = b
l.w = g
b.u = n
k.u = l
k.x = l
k.p = n
c.o = m
c.u = k
c.r = l
m.t = l
n.u = l
n.x = l
n.p = k
g.o = m
g.u = n
g.r = l
assert n.p.u.w.r.w.r.txt == "l"