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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: B = None
        self.r: C = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
n = C("n")
l = D("l")
f = D("f")
b = B("b")
g = B("g")

e.w = n
e.q = f
e.x = j
j.z = e
j.x = g
j.r = n
n.t = e
n.r = l
n.w = j
n.u = f
l.z = e
l.q = j
l.s = n
l.u = f
f.z = e
f.q = b
f.s = n
f.u = l
b.z = e
b.x = j
b.r = n
g.z = e
g.x = j
g.r = n
assert l.u.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: D = None
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: B = None
        self.r: C = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
n = C("n")
l = D("l")
f = D("f")
b = B("b")
g = B("g")

e.w = n
e.q = f
e.x = j
j.z = e
j.x = g
j.r = n
n.t = e
n.r = l
n.w = j
n.u = f
l.z = e
l.q = j
l.s = n
l.u = f
f.z = e
f.q = b
f.s = n
f.u = l
b.z = e
b.x = j
b.r = n
g.z = e
g.x = j
g.r = n
assert l.u.u.q.txt == "j"