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

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

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

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

f = A("f")
e = B("e")
m = C("m")
n = D("n")
a = B("a")
j = D("j")

f.t = e
e.y = m
e.s = f
m.u = f
m.q = f
m.o = a
m.r = n
n.v = f
n.u = e
a.y = m
a.s = f
j.v = f
j.u = e
assert f.t.s.t.y.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
m = C("m")
n = D("n")
a = B("a")
j = D("j")

f.t = e
e.y = m
e.s = f
m.u = f
m.q = f
m.o = a
m.r = n
n.v = f
n.u = e
a.y = m
a.s = f
j.v = f
j.u = e
assert f.t.s.t.y.o.s.txt == "f"