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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: B = None
        self.y: C = None
        self.o: B = None
        self.txt = txt

h = A("h")
b = B("b")
l = C("l")
k = D("k")
g = D("g")
d = C("d")

h.w = l
h.o = k
b.t = g
b.o = d
l.w = b
l.v = b
l.r = g
l.o = k
k.s = h
k.x = b
k.o = b
k.y = d
g.s = h
g.x = b
g.o = b
g.y = l
d.w = b
d.v = b
d.r = g
d.o = k
assert d.r.y.v.t.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: B = None
        self.y: C = None
        self.o: B = None
        self.txt = txt

h = A("h")
b = B("b")
l = C("l")
k = D("k")
g = D("g")
d = C("d")

h.w = l
h.o = k
b.t = g
b.o = d
l.w = b
l.v = b
l.r = g
l.o = k
k.s = h
k.x = b
k.o = b
k.y = d
g.s = h
g.x = b
g.o = b
g.y = l
d.w = b
d.v = b
d.r = g
d.o = k
assert d.r.y.v.t.y.o.txt == "k"