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

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

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

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

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

h = A("h")
i = B("i")
b = C("b")
j = D("j")
f = E("f")
n = B("n")
e = E("e")

h.w = b
h.t = i
i.u = n
i.p = n
b.p = j
b.w = j
b.u = i
j.o = h
j.v = h
j.u = h
j.w = n
j.s = b
f.v = e
f.w = j
f.x = j
f.r = h
n.u = i
n.p = i
e.v = f
e.w = j
e.x = j
e.r = h
assert f.r.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

h = A("h")
i = B("i")
b = C("b")
j = D("j")
f = E("f")
n = B("n")
e = E("e")

h.w = b
h.t = i
i.u = n
i.p = n
b.p = j
b.w = j
b.u = i
j.o = h
j.v = h
j.u = h
j.w = n
j.s = b
f.v = e
f.w = j
f.x = j
f.r = h
n.u = i
n.p = i
e.v = f
e.w = j
e.x = j
e.r = h
assert f.r.t.p.txt == "n"