class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.y: A = None
        self.r: B = None
        self.txt = txt

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

g = A("g")
a = B("a")
b = C("b")
e = D("e")
m = A("m")
l = D("l")
h = B("h")
k = B("k")

g.s = m
g.v = k
a.w = l
a.u = m
a.x = b
b.p = a
b.v = m
b.y = m
b.r = h
e.y = b
e.o = m
m.s = g
m.v = a
l.y = b
l.o = g
h.w = l
h.u = g
h.x = b
k.w = e
k.u = m
k.x = b
assert b.p.w.o.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.y: A = None
        self.r: B = None
        self.txt = txt

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

g = A("g")
a = B("a")
b = C("b")
e = D("e")
m = A("m")
l = D("l")
h = B("h")
k = B("k")

g.s = m
g.v = k
a.w = l
a.u = m
a.x = b
b.p = a
b.v = m
b.y = m
b.r = h
e.y = b
e.o = m
m.s = g
m.v = a
l.y = b
l.o = g
h.w = l
h.u = g
h.x = b
k.w = e
k.u = m
k.x = b
assert b.p.w.o.s.v.x.txt == "b"