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

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

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

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

j = A("j")
f = B("f")
d = C("d")
g = D("g")
b = B("b")
h = B("h")
c = B("c")
k = A("k")
l = B("l")
n = A("n")

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

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

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

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

j = A("j")
f = B("f")
d = C("d")
g = D("g")
b = B("b")
h = B("h")
c = B("c")
k = A("k")
l = B("l")
n = A("n")

j.v = d
j.q = d
j.x = d
j.w = n
f.s = g
d.o = j
d.x = b
g.x = j
g.y = j
b.s = g
h.s = g
c.s = g
k.v = d
k.q = d
k.x = d
k.w = j
l.s = g
n.v = d
n.q = d
n.x = d
n.w = k
assert f.s.y.q.o.w.w.txt == "k"