class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
j = C("j")
a = D("a")
d = E("d")
n = D("n")
b = C("b")
m = E("m")
e = A("e")
c = B("c")

f.y = e
f.z = a
f.x = n
g.r = f
g.w = a
j.q = b
a.t = m
a.u = g
a.r = f
d.s = b
d.v = a
d.t = n
n.t = d
n.u = c
n.r = f
b.q = j
m.s = b
m.v = n
m.t = n
e.y = f
e.z = a
e.x = n
c.r = e
c.w = n
assert n.u.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
j = C("j")
a = D("a")
d = E("d")
n = D("n")
b = C("b")
m = E("m")
e = A("e")
c = B("c")

f.y = e
f.z = a
f.x = n
g.r = f
g.w = a
j.q = b
a.t = m
a.u = g
a.r = f
d.s = b
d.v = a
d.t = n
n.t = d
n.u = c
n.r = f
b.q = j
m.s = b
m.v = n
m.t = n
e.y = f
e.z = a
e.x = n
c.r = e
c.w = n
assert n.u.w.r.txt == "f"