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

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

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

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

j = A("j")
g = B("g")
f = C("f")
i = D("i")
n = B("n")
b = A("b")
a = B("a")
k = D("k")

j.x = i
j.w = a
j.r = k
g.z = n
g.u = j
g.v = j
g.r = i
f.p = i
f.v = a
i.s = f
i.z = f
i.x = j
i.q = b
n.z = g
n.u = j
n.v = b
n.r = i
b.x = k
b.r = k
b.w = n
a.z = n
a.u = j
a.v = j
a.r = i
k.s = f
k.z = f
k.x = j
k.q = j
assert b.x.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: B = None
        self.r: D = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
f = C("f")
i = D("i")
n = B("n")
b = A("b")
a = B("a")
k = D("k")

j.x = i
j.w = a
j.r = k
g.z = n
g.u = j
g.v = j
g.r = i
f.p = i
f.v = a
i.s = f
i.z = f
i.x = j
i.q = b
n.z = g
n.u = j
n.v = b
n.r = i
b.x = k
b.r = k
b.w = n
a.z = n
a.u = j
a.v = j
a.r = i
k.s = f
k.z = f
k.x = j
k.q = j
assert b.x.x.r.txt == "k"