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

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

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

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

k = A("k")
g = B("g")
l = C("l")
d = D("d")
a = B("a")
e = C("e")
b = B("b")
f = C("f")

k.q = b
k.o = g
k.r = a
k.s = a
g.v = k
g.p = a
l.t = k
l.v = k
l.q = d
d.s = g
d.u = k
d.y = b
a.v = k
a.p = b
e.t = k
e.v = k
e.q = d
b.v = k
b.p = a
f.t = k
f.v = k
f.q = d
assert a.v.r.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

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

k = A("k")
g = B("g")
l = C("l")
d = D("d")
a = B("a")
e = C("e")
b = B("b")
f = C("f")

k.q = b
k.o = g
k.r = a
k.s = a
g.v = k
g.p = a
l.t = k
l.v = k
l.q = d
d.s = g
d.u = k
d.y = b
a.v = k
a.p = b
e.t = k
e.v = k
e.q = d
b.v = k
b.p = a
f.t = k
f.v = k
f.q = d
assert a.v.r.v.o.txt == "g"