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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.y: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: E = None
        self.t: D = None
        self.v: B = None
        self.txt = txt

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

d.x = h
d.r = h
d.y = g
d.w = n
b.w = d
n.x = h
n.r = c
c.u = g
k.x = n
k.z = n
k.y = j
h.y = g
h.z = j
h.t = c
h.v = a
g.w = d
a.w = d
j.x = n
j.z = n
j.y = k
assert g.w.w.x.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: F = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.y: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: E = None
        self.t: D = None
        self.v: B = None
        self.txt = txt

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

d.x = h
d.r = h
d.y = g
d.w = n
b.w = d
n.x = h
n.r = c
c.u = g
k.x = n
k.z = n
k.y = j
h.y = g
h.z = j
h.t = c
h.v = a
g.w = d
a.w = d
j.x = n
j.z = n
j.y = k
assert g.w.w.x.z.z.txt == "n"