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

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

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

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

b = A("b")
f = B("f")
d = C("d")
c = D("c")
i = A("i")
n = A("n")
k = D("k")
e = B("e")

b.q = f
b.v = e
b.w = n
f.w = e
f.o = n
d.y = e
d.p = e
c.q = b
c.w = b
c.p = k
i.q = f
i.v = e
i.w = n
n.q = f
n.v = f
n.w = b
k.q = b
k.w = n
k.p = c
e.w = f
e.o = i
assert f.w.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.w: A = None
        self.txt = txt

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

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

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

b = A("b")
f = B("f")
d = C("d")
c = D("c")
i = A("i")
n = A("n")
k = D("k")
e = B("e")

b.q = f
b.v = e
b.w = n
f.w = e
f.o = n
d.y = e
d.p = e
c.q = b
c.w = b
c.p = k
i.q = f
i.v = e
i.w = n
n.q = f
n.v = f
n.w = b
k.q = b
k.w = n
k.p = c
e.w = f
e.o = i
assert f.w.o.v.txt == "e"