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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: D = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: D = None
        self.u: A = None
        self.txt = txt

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

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

h.o = l
k.o = m
k.w = m
k.u = c
k.v = b
l.r = k
l.w = c
m.q = b
m.p = e
m.u = f
b.z = m
c.r = k
c.w = l
f.o = l
e.q = b
e.p = m
e.u = f
assert k.u.w.r.txt == "k"