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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.v: B = None
        self.u: D = None
        self.w: C = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
h = C("h")
j = D("j")
g = E("g")
m = F("m")
l = A("l")
b = A("b")
n = F("n")
f = D("f")

d.y = f
d.o = l
c.x = h
c.t = d
c.o = b
c.w = f
h.r = g
h.p = m
j.o = c
j.v = c
j.s = f
j.u = f
j.w = h
g.w = m
m.z = c
m.q = c
m.t = n
m.r = h
l.y = f
l.o = b
b.y = j
b.o = d
n.z = c
n.q = c
n.t = m
n.r = h
f.o = c
f.v = c
f.s = j
f.u = j
f.w = h
assert f.w.p.r.r.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.v: B = None
        self.u: D = None
        self.w: C = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
h = C("h")
j = D("j")
g = E("g")
m = F("m")
l = A("l")
b = A("b")
n = F("n")
f = D("f")

d.y = f
d.o = l
c.x = h
c.t = d
c.o = b
c.w = f
h.r = g
h.p = m
j.o = c
j.v = c
j.s = f
j.u = f
j.w = h
g.w = m
m.z = c
m.q = c
m.t = n
m.r = h
l.y = f
l.o = b
b.y = j
b.o = d
n.z = c
n.q = c
n.t = m
n.r = h
f.o = c
f.v = c
f.s = j
f.u = j
f.w = h
assert f.w.p.r.r.w.z.txt == "c"