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

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

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

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

k = A("k")
i = B("i")
g = C("g")
h = D("h")
l = D("l")
a = C("a")
m = A("m")
f = C("f")
e = B("e")

k.y = l
k.w = f
k.q = m
i.x = f
i.u = f
i.q = e
i.y = h
g.t = f
g.o = a
g.q = a
h.z = g
h.p = e
h.v = m
l.z = a
l.p = i
l.v = k
a.t = g
a.o = g
a.q = f
m.y = h
m.w = g
m.q = k
f.t = a
f.o = a
f.q = g
e.x = g
e.u = a
e.q = i
e.y = h
assert i.u.q.t.q.q.o.o.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: C = None
        self.q: A = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
g = C("g")
h = D("h")
l = D("l")
a = C("a")
m = A("m")
f = C("f")
e = B("e")

k.y = l
k.w = f
k.q = m
i.x = f
i.u = f
i.q = e
i.y = h
g.t = f
g.o = a
g.q = a
h.z = g
h.p = e
h.v = m
l.z = a
l.p = i
l.v = k
a.t = g
a.o = g
a.q = f
m.y = h
m.w = g
m.q = k
f.t = a
f.o = a
f.q = g
e.x = g
e.u = a
e.q = i
e.y = h
assert i.u.q.t.q.q.o.o.o.t.txt == "f"