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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.w: D = None
        self.u: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

j = A("j")
a = B("a")
k = C("k")
h = D("h")
c = E("c")
f = F("f")
m = C("m")
n = D("n")
d = B("d")

j.q = n
j.p = d
j.t = a
j.y = a
a.w = d
a.r = d
k.y = f
h.w = d
c.z = m
c.p = d
c.w = n
c.u = f
c.x = f
f.y = a
m.y = f
n.w = a
d.w = a
d.r = a
assert m.y.y.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: B = None
        self.t: B = None
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.w: D = None
        self.u: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

j = A("j")
a = B("a")
k = C("k")
h = D("h")
c = E("c")
f = F("f")
m = C("m")
n = D("n")
d = B("d")

j.q = n
j.p = d
j.t = a
j.y = a
a.w = d
a.r = d
k.y = f
h.w = d
c.z = m
c.p = d
c.w = n
c.u = f
c.x = f
f.y = a
m.y = f
n.w = a
d.w = a
d.r = a
assert m.y.y.w.w.txt == "a"