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

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

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

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

m = A("m")
k = B("k")
n = C("n")
i = D("i")
f = B("f")
g = D("g")
l = B("l")
b = C("b")

m.p = g
m.y = g
m.q = n
k.x = g
n.y = g
i.t = b
i.o = m
i.y = l
f.x = g
g.t = b
g.o = m
g.y = l
l.x = i
b.y = g
assert f.x.t.y.t.y.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: D = None
        self.q: C = None
        self.txt = txt

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

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

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

m = A("m")
k = B("k")
n = C("n")
i = D("i")
f = B("f")
g = D("g")
l = B("l")
b = C("b")

m.p = g
m.y = g
m.q = n
k.x = g
n.y = g
i.t = b
i.o = m
i.y = l
f.x = g
g.t = b
g.o = m
g.y = l
l.x = i
b.y = g
assert f.x.t.y.t.y.o.q.txt == "n"