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

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

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

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

m = A("m")
f = B("f")
j = C("j")
d = D("d")
b = A("b")
a = C("a")
n = B("n")
l = D("l")
k = B("k")

m.t = k
m.p = n
m.s = b
m.q = l
f.w = l
f.y = b
f.u = n
j.r = f
j.t = a
j.q = k
j.o = l
d.r = f
d.o = m
d.q = l
b.t = f
b.p = f
b.s = m
b.q = d
a.r = k
a.t = j
a.q = n
a.o = l
n.w = l
n.y = b
n.u = f
l.r = n
l.o = b
l.q = d
k.w = l
k.y = b
k.u = f
assert m.p.y.t.y.q.r.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: B = None
        self.s: A = None
        self.q: D = None
        self.txt = txt

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

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

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

m = A("m")
f = B("f")
j = C("j")
d = D("d")
b = A("b")
a = C("a")
n = B("n")
l = D("l")
k = B("k")

m.t = k
m.p = n
m.s = b
m.q = l
f.w = l
f.y = b
f.u = n
j.r = f
j.t = a
j.q = k
j.o = l
d.r = f
d.o = m
d.q = l
b.t = f
b.p = f
b.s = m
b.q = d
a.r = k
a.t = j
a.q = n
a.o = l
n.w = l
n.y = b
n.u = f
l.r = n
l.o = b
l.q = d
k.w = l
k.y = b
k.u = f
assert m.p.y.t.y.q.r.u.w.q.txt == "d"