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

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

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

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

g = A("g")
i = B("i")
a = C("a")
f = D("f")

g.q = a
g.u = a
g.x = a
i.s = g
i.u = g
i.z = g
i.y = g
a.w = i
f.t = a
f.o = a
f.y = g
f.p = i
assert g.x.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: C = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
a = C("a")
f = D("f")

g.q = a
g.u = a
g.x = a
i.s = g
i.u = g
i.z = g
i.y = g
a.w = i
f.t = a
f.o = a
f.y = g
f.p = i
assert g.x.w.u.txt == "g"