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

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

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

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

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

b = A("b")
j = B("j")
n = C("n")
c = D("c")
m = E("m")
a = A("a")
f = C("f")
i = E("i")

b.u = i
b.r = j
j.r = i
j.t = a
j.y = n
n.w = f
n.o = f
n.r = c
n.x = c
c.r = b
m.x = b
m.z = j
m.p = c
a.u = i
a.r = j
f.w = n
f.o = n
f.r = c
f.x = c
i.x = b
i.z = j
i.p = c
assert f.o.w.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

b = A("b")
j = B("j")
n = C("n")
c = D("c")
m = E("m")
a = A("a")
f = C("f")
i = E("i")

b.u = i
b.r = j
j.r = i
j.t = a
j.y = n
n.w = f
n.o = f
n.r = c
n.x = c
c.r = b
m.x = b
m.z = j
m.p = c
a.u = i
a.r = j
f.w = n
f.o = n
f.r = c
f.x = c
i.x = b
i.z = j
i.p = c
assert f.o.w.w.w.r.txt == "c"