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

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

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

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

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

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

k.u = a
k.r = a
k.t = h
k.y = i
f.p = l
f.s = i
f.r = c
n.u = a
n.w = a
n.x = l
a.v = k
a.w = n
l.w = f
l.u = i
h.v = k
h.w = n
i.w = f
i.u = l
c.p = l
c.s = l
c.r = f
assert i.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: D = None
        self.y: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

k.u = a
k.r = a
k.t = h
k.y = i
f.p = l
f.s = i
f.r = c
n.u = a
n.w = a
n.x = l
a.v = k
a.w = n
l.w = f
l.u = i
h.v = k
h.w = n
i.w = f
i.u = l
c.p = l
c.s = l
c.r = f
assert i.w.p.w.txt == "f"