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

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

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

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

e = A("e")
b = B("b")
g = C("g")
f = D("f")
c = A("c")
k = D("k")
h = B("h")

e.v = g
e.s = g
e.q = h
e.w = c
b.s = h
b.o = g
g.w = b
f.o = h
f.y = b
c.v = g
c.s = g
c.q = b
c.w = e
k.o = h
k.y = b
h.s = b
h.o = g
assert b.o.w.s.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
g = C("g")
f = D("f")
c = A("c")
k = D("k")
h = B("h")

e.v = g
e.s = g
e.q = h
e.w = c
b.s = h
b.o = g
g.w = b
f.o = h
f.y = b
c.v = g
c.s = g
c.q = b
c.w = e
k.o = h
k.y = b
h.s = b
h.o = g
assert b.o.w.s.o.w.txt == "b"