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

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

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

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

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

k = A("k")
n = B("n")
c = C("c")
i = D("i")
h = E("h")
b = D("b")
l = A("l")
f = B("f")
m = B("m")

k.u = c
n.w = m
n.z = m
n.p = l
n.r = c
n.x = h
c.y = l
c.r = m
i.x = h
i.w = c
i.u = c
i.v = b
i.r = f
h.r = f
b.x = h
b.w = c
b.u = c
b.v = i
b.r = m
l.u = c
f.w = m
f.p = l
f.z = n
f.r = c
f.x = h
m.w = f
m.p = k
m.z = n
m.r = c
m.x = h
assert b.u.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
c = C("c")
i = D("i")
h = E("h")
b = D("b")
l = A("l")
f = B("f")
m = B("m")

k.u = c
n.w = m
n.z = m
n.p = l
n.r = c
n.x = h
c.y = l
c.r = m
i.x = h
i.w = c
i.u = c
i.v = b
i.r = f
h.r = f
b.x = h
b.w = c
b.u = c
b.v = i
b.r = m
l.u = c
f.w = m
f.p = l
f.z = n
f.r = c
f.x = h
m.w = f
m.p = k
m.z = n
m.r = c
m.x = h
assert b.u.r.w.txt == "f"