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

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

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

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

b = A("b")
e = B("e")
k = C("k")
n = D("n")
h = D("h")
i = D("i")
g = A("g")

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

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

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

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

b = A("b")
e = B("e")
k = C("k")
n = D("n")
h = D("h")
i = D("i")
g = A("g")

b.v = e
b.o = e
b.y = k
b.q = g
e.w = b
k.s = e
n.t = e
n.x = e
h.t = e
h.x = e
i.t = e
i.x = e
g.v = e
g.o = e
g.y = k
g.q = b
assert e.w.y.s.txt == "e"