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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: F = None
        self.w: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
d = C("d")
g = D("g")
k = E("k")
b = F("b")
e = B("e")
n = D("n")
m = E("m")

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: F = None
        self.w: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
d = C("d")
g = D("g")
k = E("k")
b = F("b")
e = B("e")
n = D("n")
m = E("m")

c.z = g
c.x = e
f.z = m
f.w = m
f.q = m
f.t = b
d.z = c
d.r = c
g.w = k
g.x = e
k.r = g
k.y = e
k.x = m
b.x = c
b.r = f
b.w = d
b.u = n
b.z = k
b.y = e
e.z = m
e.w = m
e.q = m
e.t = b
n.w = m
n.x = f
m.r = g
m.y = e
m.x = k
assert d.r.z.w.r.w.x.y.t.txt == "b"