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

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

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

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

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

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

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

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

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

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

f.o = k
f.t = n
f.r = i
f.y = e
e.x = n
e.u = n
i.t = n
h.p = m
h.w = n
h.u = n
h.q = k
a.x = n
a.u = n
k.o = f
k.t = h
k.r = i
k.y = a
n.p = m
n.w = h
n.u = h
n.q = k
m.t = n
assert f.t.q.o.o.txt == "k"