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

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

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

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

j = A("j")
n = B("n")
e = C("e")
k = D("k")
g = A("g")
m = C("m")

j.q = e
j.v = k
n.z = m
e.z = m
e.u = j
e.x = n
e.v = n
k.w = m
k.t = e
g.q = e
g.v = k
m.z = e
m.u = j
m.x = n
m.v = n
assert m.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: D = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
e = C("e")
k = D("k")
g = A("g")
m = C("m")

j.q = e
j.v = k
n.z = m
e.z = m
e.u = j
e.x = n
e.v = n
k.w = m
k.t = e
g.q = e
g.v = k
m.z = e
m.u = j
m.x = n
m.v = n
assert m.u.q.u.txt == "j"