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

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

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

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

h = A("h")
c = B("c")
l = C("l")
j = D("j")
b = A("b")
m = C("m")
a = C("a")
f = C("f")
e = D("e")
k = B("k")

h.x = b
h.s = b
h.y = e
h.o = c
c.s = j
c.v = b
l.q = b
l.o = m
j.y = l
b.x = h
b.s = h
b.y = j
b.o = c
m.q = h
m.o = f
a.q = h
a.o = m
f.q = b
f.o = l
e.y = m
k.s = j
k.v = h
assert f.o.o.o.q.o.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: D = None
        self.o: B = None
        self.s: A = None
        self.txt = txt

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

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

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

h = A("h")
c = B("c")
l = C("l")
j = D("j")
b = A("b")
m = C("m")
a = C("a")
f = C("f")
e = D("e")
k = B("k")

h.x = b
h.s = b
h.y = e
h.o = c
c.s = j
c.v = b
l.q = b
l.o = m
j.y = l
b.x = h
b.s = h
b.y = j
b.o = c
m.q = h
m.o = f
a.q = h
a.o = m
f.q = b
f.o = l
e.y = m
k.s = j
k.v = h
assert f.o.o.o.q.o.v.o.v.txt == "b"