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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.s: D = None
        self.w: C = None
        self.r: C = None
        self.txt = txt

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

f.t = e
f.q = n
h.o = n
h.w = b
e.v = l
e.r = f
e.o = f
e.w = f
e.u = b
b.q = h
b.r = h
n.p = f
n.y = b
n.s = l
n.w = e
n.r = e
l.q = h
l.r = h
assert b.q.w.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.s: D = None
        self.w: C = None
        self.r: C = None
        self.txt = txt

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

f.t = e
f.q = n
h.o = n
h.w = b
e.v = l
e.r = f
e.o = f
e.w = f
e.u = b
b.q = h
b.r = h
n.p = f
n.y = b
n.s = l
n.w = e
n.r = e
l.q = h
l.r = h
assert b.q.w.r.w.txt == "b"