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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: B = None
        self.z: A = None
        self.o: D = None
        self.txt = txt

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

i = A("i")
k = B("k")
j = C("j")
a = D("a")
h = C("h")
b = A("b")
d = B("d")
c = C("c")
m = C("m")

i.y = h
i.u = k
i.q = b
i.w = b
k.v = d
k.o = d
k.q = j
j.v = b
j.z = b
j.r = k
j.o = a
a.o = i
a.y = k
a.p = d
h.v = b
h.r = k
h.z = i
h.o = a
b.y = j
b.u = d
b.q = i
b.w = i
d.v = k
d.o = k
d.q = c
c.v = i
c.z = i
c.r = d
c.o = a
m.v = b
m.r = d
m.z = i
m.o = a
assert k.v.q.o.y.q.z.y.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: B = None
        self.q: A = None
        self.w: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: B = None
        self.z: A = None
        self.o: D = None
        self.txt = txt

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

i = A("i")
k = B("k")
j = C("j")
a = D("a")
h = C("h")
b = A("b")
d = B("d")
c = C("c")
m = C("m")

i.y = h
i.u = k
i.q = b
i.w = b
k.v = d
k.o = d
k.q = j
j.v = b
j.z = b
j.r = k
j.o = a
a.o = i
a.y = k
a.p = d
h.v = b
h.r = k
h.z = i
h.o = a
b.y = j
b.u = d
b.q = i
b.w = i
d.v = k
d.o = k
d.q = c
c.v = i
c.z = i
c.r = d
c.o = a
m.v = b
m.r = d
m.z = i
m.o = a
assert k.v.q.o.y.q.z.y.r.o.txt == "d"