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

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

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

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

b = A("b")
l = B("l")
j = C("j")
k = D("k")
e = C("e")
f = A("f")
h = A("h")

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

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

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

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

b = A("b")
l = B("l")
j = C("j")
k = D("k")
e = C("e")
f = A("f")
h = A("h")

b.r = h
b.w = l
b.z = j
l.w = h
l.o = k
l.s = k
l.u = f
j.t = l
j.z = l
j.r = h
k.x = e
k.t = h
e.t = l
e.z = l
e.r = h
f.r = b
f.w = l
f.z = e
h.r = b
h.w = l
h.z = j
assert k.x.t.w.w.w.r.txt == "b"