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

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

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

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

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

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

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

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

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

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

f.u = c
f.q = j
f.p = a
a.r = n
a.u = f
a.o = j
n.q = f
n.x = a
n.u = c
j.t = e
j.u = a
j.y = c
j.s = n
c.t = e
c.u = a
c.y = j
c.s = n
e.t = j
e.y = j
e.u = a
e.s = n
assert j.s.u.y.u.u.txt == "f"