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

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

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

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

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

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

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

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

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

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

f.u = e
f.t = b
d.s = e
d.y = c
d.t = i
n.r = j
n.w = d
n.q = e
b.q = f
c.q = a
i.s = n
i.y = j
i.t = d
a.u = n
a.t = c
e.r = j
e.w = d
e.q = n
j.q = f
assert n.w.t.y.q.u.q.txt == "n"